2012-07-01 48 views
0

我使用jQuery移動以從遠程JSON加載的信息,然後把它放在列表中的每個白衣的縮略圖。這是我喜歡顯示加載圖像,直到每個圖像加載的問題。啓動並行加載圖像,並使用它時,滿載

我嘗試使用每個圖像中的一個id並替換它的src。但這不是一個乾淨的方式。

// Add each json elemnt to list with image with id 
$('#list_nearbys').append("<li><a href=''><img id=" + this.id + " src='" + image + "' width='115' height='115'></img></p><h3>" + this.title + "</h3><p>" + this.description + 
"</p></a></li>"); 

// refresh the list 
$('#list_nearbys').listview('refresh'); 

// Here i modify the original image with a loading image 
$("img[id$='" + this.id + "']").attr('src', "images/ajax-loader.gif"); 

// Here i should launch the load from image and when the image was loaded replace with this. 

有什麼想法嗎?在此先感謝

回答

相關問題