Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine when image finished loading with JavaScript or jQuery:

Tags:

How can I detect with JavaScript or jQuery when an image has finished loading, be it from the server or the browser cache? I want to load various images in the same <img/> tag and detect when the loading of a new images has finished.

like image 662
Francisc Avatar asked Dec 20 '10 22:12

Francisc


1 Answers

$('img').on('load', function() {     // do whatever you want }); 
like image 71
Matthew Avatar answered Oct 14 '22 13:10

Matthew