完全滑动检测工作

时间:2014-07-29 10:56:59

标签: jquery mobile swipe

我在使用phonegap应用程序时遇到滑动事件的问题。滑动(向左或向右)始终不起作用。 结构

$(document).on('swiperight',function(event,data){
        event.stopImmediatePropagation(); 

            alert('left');
        });

    $(document).on('swipeleft',function(event,data){
            event.stopImmediatePropagation(); 

            alert('right');
        });

有时我需要进行3-4次滑动以显示警报。 我可以减少定义滑动的水平距离,或者我可以随时做什么工作?

1 个答案:

答案 0 :(得分:0)

你可以有这样的东西,你需要做的就是调用

下的两个函数
 $(document).ready(function(){
  SwipeRight();
  SwipeLeft();
    };

function SwipeRight() {
$(document).on('swiperight',function(event,data){
event.stopImmediatePropagation(); 

            alert('left');
        });
}
function SwipeLeft() {
    $(document).on('swipeleft',function(event,data){
         event.stopImmediatePropagation(); 

            alert('right');
        });
}