大佬教程收集整理的这篇文章主要介绍了滑动回去在jQuery Mobile?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑:
我发现这个解决方案,谷歌有点多:
$('body').live('pagecreate',function (event) { $('div.ui-page').live("swipeleft",function () { var nextpage = $(this).next('div[data-role="page"]'); // swipe using id of next page if exists if (nextpage.length > 0) { $.mobile.changePage(nextpage,'slide'); } }); $('div.ui-page').live("swiperight",function () { var prevpage = $(this).prev('div[data-role="page"]'); // swipe using id of prevIoUs page if exists if (prevpage.length > 0) { $.mobile.changePage(prevpage,'slide',truE); } // history.BACk(); // return false; }); });
这确实有效,但似乎并不稳定.当你滑动时,它会来回跳动.我还尝试了最后的注释掉的代码 – history.BACk(),这是在另一个网站上建议的.但这似乎更加不稳定,导致各种奇怪的跳跃.
$(document).ready(function() { $('.yourPage').live('swipeleft swiperight',function(event){ if (event.type == "swiperight") { var prev = $("#previndex",$.mobile.activePagE); var previndex = $(prev).data("index"); if(previndex != '') { $.mobile.changePage({url:"index.PHP",type:"get",data:"index="+previndex},"slide",truE); } } if (event.type == "swipeleft") { var next = $("#nexTindex",$.mobile.activePagE); var nexTindex = $(next).data("index"); if(nexTindex != '') { $.mobile.changePage({url:"index.PHP",data:"index="+nexTindex}); } } event.preventDefault(); }); });
另外,这个YouTube视频也可以帮助您.
http://www.youtube.com/watch?v=Ij1RYI1p7rM
以上是大佬教程为你收集整理的滑动回去在jQuery Mobile?全部内容,希望文章能够帮你解决滑动回去在jQuery Mobile?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。