大佬教程收集整理的这篇文章主要介绍了jquery-mobile – 防止特定元素上的JQuery Mobile滑动事件,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的javascript代码:@H_301_3@
$( document ).on( "pageinit","#demo-page",function() { $( document ).on( "swipeleft swiperight",function( e ) { // We check if there is no open panel on the page because otherwise // a swipe to close the left panel would also open the right panel (and v.v.). // We do this by checking the data that the framework stores on the page element (panel: open). if ( $.mobile.activePage.jqmData( "panel" ) !== "open" ) { if ( e.type === "swipeleft" ) { $( "#right-panel" ).panel( "open" ); } else if ( e.type === "swiperight" ) { $( "#left-panel" ).panel( "open" ); } } }); });
谢谢.@H_301_3@
对于.SELEctor,它可以是标签和#ID或.class,例如[data-role = page]#PagEID,div.ui-content …等@H_301_3@
$(document).on('swipeleft swiperight','.SELEctor',function(event) { event.stopPropagation(); event.preventDefault(); });
>参考:stopPropagation();
>参考:preventDefault();
> Working example@H_301_3@
以上是大佬教程为你收集整理的jquery-mobile – 防止特定元素上的JQuery Mobile滑动事件全部内容,希望文章能够帮你解决jquery-mobile – 防止特定元素上的JQuery Mobile滑动事件所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。