I want to know when an image has finished loading. Is there a way to do it with a callback?
If not, is there a way to do it at all?
Here is jQuery equivalent:
var $img = $('img'); if ($img.length > 0 && !$img.get(0).complete) { $img.on('load', triggerAction); } function triggerAction() { alert('img has been loaded'); }