如果没有在触摸事件上使用event.preventDefault(),为什么jquery移动侧面板触摸滑动不能顺利运行?

时间:2014-09-08 12:36:07

标签: javascript jquery jquery-mobile cordova

我正在使用touchmove事件上的event.preventDefault()正常工作面板幻灯片。但它会停止我的应用程序中的所有滚动。

如果没有此代码,我无法顺利打开侧面板。 (它在3-4次尝试后打开)

$(document).on('touchmove', function(event){

        event.preventDefault();

});

用手指右键滑动打开/关闭面板的代码

$(document).on('pageinit', function(event){

      // Bind the swipeHandler callback function to the swipe event on div.box

      $( "[data-role='page']" ).on( "swiperight", function( event, ui ) {swipeRightHandler($.mobile.activePage.attr('id'));} );


        function swipeRightHandler( page_id ){
              $( "#"+page_id+"_panel" ).panel( "open" );
        }
    });

0 个答案:

没有答案