Greasy Fork

jQuery touch action Ex

簡単なタッチ操作のイベントを追加します

目前为 2021-01-08 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.icu/scripts/419065/888671/jQuery%20touch%20action%20Ex.js

// ==UserScript==
// @name         jQuery touch action Ex
// @version      0.2
// @description  簡単なタッチ操作のイベントを追加します
// @author       y_kahou
// @require      https://greasyfork.org/scripts/419806-touchactionex/code/touchActionEx.js?version=888659
// ==/UserScript==

if (window.jQuery) (function($) {
    'use strict';
    
    $.fn.tap = function(interval = 200) {
        addTap(this[0], {interval: interval})
        return $(this)
    }
    $.fn.doubletap = function(interval = 200) {
        addDoubletap(this[0], {interval: interval})
        return $(this)
    }
    $.fn.swipe = function(min_dist = 50) {
        addSwipe(this[0], {min_dist: min_dist})
        return $(this)
    }
    $.fn.swipe_way = function(range = 90, min_dist = 50) {
        addSwipeWay(this[0], {range: range, min_dist: min_dist})
        return $(this)
    }
})(window.jQuery);