samedi 21 mars 2015

img.on("load") firing far too many times


The following code is executing almost 100 times for the 10 images it's supposed to handle the src-loaded event for. Not exactly what I expected. What am I doing wrong?



$(".carousel-inner div.item img").on("load", function () {
//build the indicators list
foo();

console.debug(accumulator++);
if (carouselImagesLoaded == numberPhotos) {
foo2();
}
}).each(function () {
if (this.complete) $(this).load();
});




Aucun commentaire:

Enregistrer un commentaire