當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


jQWidgets jqxTouch swipeMin屬性用法及代碼示例


jQWidgets是一個 JavaScript 框架,用於為 PC 和移動設備製作基於 Web 的應用程序。它是一個非常強大、優化、獨立於平台且得到廣泛支持的框架。這 精巧x觸摸 用於識別和觸發touch-enabled設備上的‘swipe’、“向左滑動”、“向右滑動”、‘tap’和‘orientationchange’等觸摸事件。

swipeMin 屬性用於表示插件對指定 jqxTouch 小部件所需的最小滑動距離。

用法:

  • 用於設置 滑動最小 屬性:

    $('#jqxTouch').jqxTouch({swipeMin: 45});
  • 為了得到滑動最小屬性:

    var swipeMin = $('#jqxTouch').jqxTouch('swipeMin');

鏈接文件:下載jQWidgets從給定的鏈接。在 HTML 文件中,找到下載文件夾中的腳本文件。

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxtouch.js”></script>
<script type=”text/javascript” src=”scripts/jqx-all.js”></script>

例子:下麵的例子說明了jQWidgets jqxTouch滑動最小屬性。在下麵的示例中,值滑動最小 屬性已設置為 45。

HTML


<!DOCTYPE html> 
<html lang="en"> 
  
<head> 
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css" 
          type="text/css"/> 
    <script type="text/javascript" 
            src="scripts/jquery.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxcore.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxtouch.js"> 
    </script> 
    <script type="text/javascript" 
            src="scripts/jqx-all.js"> 
    </script> 
</head> 
  
<body> 
    <center> 
        <h1 style="color: green;"> 
            GeeksforGeeks 
        </h1> 
        <h3> 
            jQWidgets jqxTouch swipeMin Property 
        </h3> 
        <div id="jqx_Touch"> 
            <div style="height: 100px;  
                      width: 350px; 
                      color: black;  
                      border-radius: 10px; 
                      background: green;"> 
                <b>Swipe, Swipe Left, Swipe Right and Tap</b> 
            </div> 
        </div> 
        <input type="button" style="margin: 28px;"
               id="button_for_swipeMin"
         value="Value of the swipeMin property"/> 
        <div id="log"></div> 
        <script type="text/javascript"> 
            $(document).ready(function () { 
                $('#jqx_Touch').jqxTouch({ 
                    swipeMin: 45 
                }); 
                $('#jqx_Touch').on('swipeleft', function () { 
                    $("#log").html("Swiped left"); 
                }); 
                $('#jqx_Touch').on('swiperight', function () { 
                    $("#log").html("Swiped right"); 
                }); 
                $('#jqx_Touch').on('tap', function () { 
                    $("#log").html("Tapped"); 
                }); 
                $('#jqx_Touch').on('swipe', function () { 
                    $("#log").html("Swiped"); 
                }); 
                $("#button_for_swipeMin"). 
                    jqxButton({ 
                        width: 350 
                    }); 
                $("#button_for_swipeMin").click( 
                    function () { 
                        var swipeMin_Value = 
                          $('#jqx_Touch'). 
                             jqxTouch('swipeMin'); 
                        $("#log").html(swipeMin_Value); 
                    }); 
            }); 
        </script> 
    </center> 
</body> 
  
</html>

輸出:

參考: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtouch/jquery-touch-api.htm



相關用法


注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 jQWidgets jqxTouch swipeMin Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。