jQuery-Extensions-touchJS

jQuery-Extensions-touchJS是一个非常简单的jQuery touch扩展,用于适配移动端的常用touch操作(点击tab、双击dbTab、长按longPress、长按终止longPressCancel、滑动swipe以及具体滑动方向left right up down)

Verze ze dne 30. 11. 2022. Zobrazit nejnovější verzi.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greasyfork.org/scripts/454450/1123028/jQuery-Extensions-touchJS.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Autor
tutu辣么可爱
Verze
1.3
Vytvořeno
08. 11. 2022
Aktualizováno
30. 11. 2022
Size
5,2 KB
Licence
neuvedeno

jQuery-Extensions-touchJS

  • 一个非常简单的jQuery touch扩展,用于适配移动端的常用touch操作
  • 支持的touch事件:点击tab、双击dbTab、长按longPress、长按终止longPressCancel、滑动swipe,以及具体滑动方向left right up down

使用方式

  • 添加单个事件(以长按为例)
//指定事件名(可省略,但省略后无法指定删除此事件)
$(selector).touch("longPress",()=>{
  //具体业务
},"myLongPress")
//或者指定方法
myLongPress=function(){
  //具体业务
}
$(selector).touch("longPress",myLongPress)
  • 批量添加事件(以长按、长按取消、点击为例)
$(selector).touch({
  //可通过myLongPress方法名指定删除此事件
  longPress:myLongPress,
  //无法指定删除
  longPressCancel(){
    //具体业务
  },
  tap(){
    //具体业务
  }
})
  • 删除指定类型的所有事件(以长按为例)
//删除longPress所有事件,格杀勿论
$.unbindTouch("longPress")
  • 删除指定方法对应的事件(以长按为例)
//通过指定事件名确认唯一事件(添加事件时指定)
$(selector).unbindTouch("longPress","myLongPress")
//或者通过指定方法确认唯一事件
$(selector).unbindTouch("longPress",myLongPress)
  • 查看所有touch事件(仅限于通过本插件产生的事件方法)
$(selector)[0].jQueryTouchFnMap