views:

38

answers:

1

Hi all, i use the following code to load image to a cell

$(cell).css("background-image", "url("+iconImage+")");

As this image is loaded from server....it take times...i want to add an activity indicator on this cell until the image is loaded and stop when the image is loaded..i saw some example but as i don't know jquery....can not figure out yet how to do it..

i will be very happy if anyone helps me to figure it out...but please try to give sample code which helps to understand the things better

+3  A: 

demo

try something like this...

$('<img/>').attr('src',iconImage).load(function(){
   // codes here when image is loaded
   alert('Image loaded');
});
$(cell).css("background-image", "url("+iconImage+")");
Reigel
Hi,great answer thanks....i think u can help me with this probhttp://stackoverflow.com/questions/3332323/javascript-code-to-place-activity-indicator-to-a-celli just want to place the indicator in the middle of each cell
Rony