jQueryTouchActionEx

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

Dette scriptet burde ikke installeres direkte. Det er et bibliotek for andre script å inkludere med det nye metadirektivet // @require https://update.greasyfork.org/scripts/419065/894972/jQueryTouchActionEx.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!)

Forfatter
家守カホウ
Versjon
0.3.1
Lagd
23.12.2020
Oppdatert
28.01.2021
Size
6,3 kB
Lisens
I/T

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

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

// 前提: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は画像参照