2013-04-30 60 views
0

我正在尝试使用滑动页面导航,但代码我似乎已被打破。这只是我的第二个应用程序,我会喜欢一些帮助。我无法在这里贴上我的代码,但我已上载我有什么学校的服务器上,这样你就可以从那里拉的源代码 -刷入页面转换?

dtc-wsuv.org/jcohen/strings

谢谢!

回答

0

根据你的源代码,你可以尝试使用on()而不是live因为live在jQuery的1.7版本,以及包装内$(document).ready(function() { })$(function() { })你的代码让jQuery的看到整个DOM弃用,因此:

$(document).ready(function() { 
    $('.swipe').on("swipeleft", function() { 
    var nextpage = $(this).next('div[data-role="page"]'); 
    if (nextpage.length > 0) { 
     $.mobile.changePage(nextpage, "slide", false, true); 
    } 
}); 

$('.swipe').on("swiperight", function() {           
    var prevpage = $(this).prev('div[data-role="page"]'); 
    if (prevpage.length > 0) { 
     $.mobile.changePage(prevpage, { 
      transition: "slide", 
      reverse: true 
     }, true, true); 
    } 
}); 
})