2013-04-30 35 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); 
    } 
}); 
})