While creating a JQuery plugin that required image dimensions, I discovered that webkit browsers like Chrome often return 0 size for images because they're loaded in parallel.
My quick and dirty solution was to wrap the code that calls my plugin in a $(window).load()
event:
$(document).ready(function() {
$(window).load(function() {
$('.magnifier').magnifier();
});
});
How would I go about implementing this inside the plugin itself? What is the cleanest way to detect that images have loaded so I can measure their dimensions?