[英]Why does swipe left not work for Jquery mobile?
我有以下代碼嘗試檢測向左和向右滑動:
$('#my_view').bind('pageinit', function() {
$( '#my_view' ).on( "swipeleft swiperight", "#myItem", function( event ) {
var listitem = $( this ),
dir = event.type === "swipeleft" ? "left" : "right";
console.log("Detected swipe!!!! " + dir);
});
});
但是,這僅檢測到右滑動而從未檢測到左滑動,有人可以解釋原因嗎?
我制造了一個小提琴,它似乎工作正常
也許對於pageinit,請使用$ {document).on:
$(document).on("pageinit", "#my_view", function(){
$('#my_view').on( "swipeleft swiperight", "#myItem li", function( event ){
alert(event.type);
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.