jQuery Mobile Touch 事件
Touch 事件在用戶觸摸屏幕(頁面)時觸發(fā)。
提示:Touch 事件同樣適用于桌面電腦:點擊鼠標(biāo)!
jQuery Mobile Tap
tap 事件在用戶敲擊某個元素時觸發(fā)。
下面的例子當(dāng) <p> 元素上觸發(fā) tap 事件時,隱藏當(dāng)前 <p> 元素:
實例
$("p").on("tap",function(){
$(this).hide();
});
jQuery Mobile Taphold
taphold 事件在用戶敲擊某個元素并保持一秒時被觸發(fā):
實例
$("p").on("taphold",function(){
$(this).hide();
});
jQuery Mobile Swipe
swipe 事件在用戶在某個元素上水平滑動超過 30px 時被觸發(fā):
實例
$("p").on("swipe",function(){
$("span").text("Swipe detected!");
});
jQuery Mobile Swipeleft
swipeleft 事件在用戶在某個元素上從左滑動超過 30px 時被觸發(fā):
實例
$("p").on("swipeleft",function(){
alert("You swiped left!");
});
jQuery Mobile Swiperight
swiperight 事件在用戶在某個元素上從右滑動超過 30px 時被觸發(fā):
實例
$("p").on("swiperight",function(){
alert("You swiped right!");
});