這讓我瘋狂。內存管理和緩存內容jquery-mobile
在webapp中,我使用jqm創建,其中一個頁面有一些可摺疊的塊,裏面有listview,當它們被點擊並且沒有摺疊時,它們動態填充。每個列表視圖中元素的數量約爲500個。考慮到每個元素都有一個縮略圖,這將成爲一個更大的問題。
當我弄糟一塊新磚時,我可以感覺到我的iphone有多辛苦。這是因爲分配給瀏覽器的內存被填滿了,我想。
當新的可摺疊塊打開時,有沒有辦法釋放內存/緩存?或者我可以阻止將數據映射到緩存,以便在性能上獲得一些啓動功能?
我接受任何其他建議。
上編輯10/13/2011
這裏是我使用
$('div.century').live('expand', function(){
var idval = $(this).attr('id');
console.log('expanded'+idval);
$.get("helpers/getByCentury.php", { id: idval},
function(data){
$("#"+idval+" ul.ulist").html(data);
$("#"+idval+" ul.ulist").listview('refresh');
});
});
謝謝..這工作。我找到的另一個解決方案是使用$(「。classofchildren」)刪除所有ulist的子項。每次調用該函數。 – locorecto
@ jasper我已經嘗試過同樣的事情,但崩潰的內容沒有得到改變。這裏是我的鏈接和code.plz幫助way2enjoy.com/touch/w2et/collapse-new2.php $('div.info')。live('展開',function(){var record = $(this).data(「record」); if(typeof(console.log)=='function'){ console.log('expanded'+ record);} $ .mobile.loadingMessage =「please wait。」; $(「。detail」,this).load(「quotesget5.php?record =」+ record, function(data){$(「。」+ info +「ul ('collapse',function(){ $(this).find().html(data).listview('refresh'); $ .mobile.showPageLoadingMsg();});})。 '檢查 ')發現(' 禮')除去();}); – Steeve
@jasper你可以幫忙 – Steeve