Notice the .load() event in the following code.
var img;
var path = "/theimage.jpg";
$(document).ready(function () {
img = new Image;
img.src = path;
$(img).load(function () {
redraw(0);
zoom(-2, 1.7, false);
});
});
This event fires successfully when the image loads…
But how can I get that .load() event to fire again if later in the life cycle of the page (say when the user clicks a link) I change the src of img to a completely new path (new image)?
The
loadevent will fire by itself again after the entire new image is loaded.