So I have a script that changes the main image src when a thumbnail is clicked on. This is all good and well, except that occasionally the image doesn’t load immediately when it is clicked on.
Essentially how do I know when the new image is loaded from the src change.
Here is the line of code I have that changes the source:
$thumbnail_image_src = $(this).find('.thumbnail-image').attr("data-full");
Bind a handler to the ‘load’ event for the img tag (this JSFiddle)
These functions will fire at the appropriate events. Enjoy!