2012-07-01 2 views
0

jquery mobile을 사용하여 원격 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. 

어떤 아이디어가 있습니까? 사전

답변

관련 문제