ProperLoad jQuery Plugin

Download

Usage

This is a jQuery plugin, so remeber to include jQuery. And view source code of this page for an example.

The javascript needed.

<script type="text/javascript" >
    $(document).ready(function(){	
        $("img").properload(callback, allImgs);
    });
</script>

allImgs this option can be 3 things: true, meaning that the only callback that will fire, is when all images has been loaded".
false, meaning that the plugin will just make a callback on each image, when it has been loaded
"both", then the plugin will fire callback both when an image has been loaded, and when all the images has been loaded. See source code of this site for example.

The "this" keyword works inside the callback function, and the callback function is called with 2 arguments, the first is wether or not this is the "all images loaded" callback, and the second is if there was an error (not 100% dependable). Again, see source of this page for example.

If this helped you do your work, then consider making a donation