JavaScript - Preload Images
I'm working on a photo gallery, and I would like the ability to have a gif preloader show before the main image is loaded, and then show the main image. So, this is what I got: I have a #photo_place which is the div that holds the main photo. This changes depending on what thumbnail the user selects. When the user does select a thumbnail, this function is triggered: function gallery(icon){ $('#photo_place').css('background-image','url("../images/'+icon+'.png")'); } Now, what I want, is to first, show a preloader gif at the #photo_place, load in the selected image ... somewhere, and when that