jQuery touch action Ex

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

As of 2021-01-08. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/419065/888669/jQuery%20touch%20action%20Ex.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Author
家守カホウ
Version
0.2
Created
2020-12-23
Updated
2021-01-08
Size
793 Bytes
License
N/A

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

  • タップ
  • ダブルタップ
  • ホールド(おまけ程度)
  • スワイプ
  • 上下左右のスワイプ

// 前提:jQueryを使用します

// 単純なタップ(interval:タップとホールドの境目の時間ms)
$('div').tap(interval)
.on('tap', e => console.log(e))
.on('hold', e => console.log(e))

// ダブルタップを考慮したタップとダブルタップ
$('div').doubletap(interval)
.on('tap', e => console.log(e))
.on('hold', e => console.log(e))
.on('doubletap', e => console.log(e))

// スワイプ(min_dist:最低認識距離pixel)
$('div').swipe(min_dist)
.on('swipe', (e, angle, distance) => {
    console.log(angle + ' ' + distance)
})

// 上下左右のスワイプ(range:水平垂直を中心に何度までを認識するか)
$('div').swipe_way(min_dist, range)
.on('swipeup swipedown swipeleft swiperight', (e, angle, distance) => console.log(e.type))

swipe_wayのrangeは画像参照