2012-07-01 33 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. 

有什么想法吗?在此先感谢

回答

相关问题