2015-06-26 51 views
0

我嘗試實現這樣使用jQuery Mobile的1.45怎麼回去一定previus頁面jQuery Mobile的

第1頁導航 - >第2頁 - >第3頁 - >回第1頁

哪有我導航到頁面1從歷史中刪除頁面3和頁面2?

這是5月功能:

function backCertainPages(cant) { 
     var history = $.mobile.navigate.history.stack; 
     history.splice(history.length - cant, cant); 
     $.mobile.navigate.history.stack = history; 
     $.mobile.back(); 
} 

但即時得到一個

Uncaught Exception: Uncaught TypeError: Cannot read property 'lastScroll' of undefined at (compiled_code):6317WL.Logger.__log @ worklight.js:5064WL.Logger.$.each.PUBLIC_API.(anonymous function) @ worklight.js:5444WL.Logger.window.onerror @ worklight.js:5404 
jquery.mobile-1.4.5.js:6317 

Uncaught TypeError: Cannot read property 'lastScroll' of undefined 

回答

0

我只是把我的轉變changeHash: false

$.mobile.pageContainer.pagecontainer("change", id, { 
     transition : "pop", 
     reverse : true, 
     role : "back", 
     changeHash: false 
    }); 

,並覆蓋所有後退按鈕邏輯,除了在第一頁