jQuery-Extensions-touchJS

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

2022-11-30 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greatest.deepsurf.us/scripts/454450/1123028/jQuery-Extensions-touchJS.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 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!)

ئاپتورى
tutu辣么可爱
نەشرى
1.3
قۇرۇلغان ۋاقتى
2022-11-08
يېڭىلانغان ۋاقتى
2022-11-30
Size
5.2 KB
ئىجازەتنامىسى
يوق

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