I\'m trying to create a simple portfolio page. I have a list of thumbs and an image. When you click on a thumb, the image will change.
When a thumbnail is clicked, I
You can do it like this:
$('img#image').attr("src", src).one('load',function() {
$(this).fadeIn(700);
}).each(function() {
if (this.complete) $(this).trigger('load');
});
If an image is cached, in some browsers .load() won't fire, so we need to check for and handle this case by checking .complete and firing load manually. .one() ensures whether it's cached or loaded at that time, that the load handler only fires once.