i’m using jquery mobile to load from remote json the information and then put it on list each whit a thumbnail. The problem it’s i like to show a loading image until each image was loaded.
I try to use an id from each image and replace the src of this. But it’s not a clean way.
// 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.
Any idea ? Thanks in advance
Using Jail Jquery Plugin
http://www.sebastianoarmelibattana.com/projects/jail