Load All Images


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function loadAllImages(images, callback) {
  2. var img = new Image();
  3. $(img).load(function () {
  4. images_loaded++;
  5. if (images_loaded === images.length) {
  6. callback();
  7. } else {
  8. loadAllImages(callback);
  9. }
  10. }).attr( 'src', image_path + images[images_loaded] );
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.