The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Can I sync up multiple image onload calls? Reply To: Can I sync up multiple image onload calls?


I had the same problem like you. I wanted to wait for multiple callbacks. Because I did not found any plugin I built a plugin for that. You can define a stack of images and on which element you want them to be appended. Your callback function will be called after all elements are successfully added to the defined element and are all loaded. You can use the same for JavaScripts.


      var requireFile = new jm.RequireFile();
          // The stack with the images to load
          'stack': [
           // The selector where the image should appear,
           // if non is defined it will be appended to the <body>-element
           'insertInto': '#load-images-here',
           // The callback if all scripts are loaded
          'completed': function(){
              alert('Hey all my images are loaded');

Documentation and Download