2012-03-28 109 views
1

嗨我想刪除一些隱藏頁面,這裏是我的代碼。jquerymobile刪除隱藏頁面

$(document).bind("mobileinit", function() { 
    $(document).bind("pagehide", function() { 
      // At this stage works fine, but Don't know how to reference the hidden page 
      alert("Hello world");  
    }); 
}); 

問題是什麼是引用被隱藏的頁面的正確方法?
可以僅使用每個()列出頁面?

+2

它看起來像你搶用'ui.prevPage'整個元素。在頁面隱藏回調函數參數'$(document).bind('pagehide',function(events,ui)''中添加參數'events,ui',然後你就可以說'$(ui.prevPage) .remove();'將這個頁面從DOM中刪除,但不知道爲什麼你會這樣做/如果這是你想要做的。 – Ohgodwhy 2012-03-28 17:58:09

+0

很tks ...我想刪除它,因爲一些頁面導致外部網頁在每次通話後都不能正常刷新,我所有的頁面都是通過創建的,這就是爲什麼我想要刪除它的原因,如果你有另外一個問題,歡迎你回答....非常感謝你的回答。 – 2012-03-28 19:28:06

回答

1

下面是一個例子:

$(document).bind("mobileinit", function() { 

    $.mobile.document.bind('pagehide', function (event, ui) { 
    $(event.target).remove(); 
    }); 

});