views:

51

answers:

1

I'm fairly new to jquery and still finding my way in it. I'm trying to execute a function, once an image is loaded into a specific div.

Here is the code I have.

$('#advanced-slideshow img').load(function() {
                var idx =  $('#mycarousel li a.activeSlide').data('index') - 2;

                carousel.scroll(idx);
                return false;
});

What I would like is each time and image is loaded into the div, #advanced-slideshow I want my function to execute.

Any help on this would be great!

A: 
$(function() {
 $('#advanced-slideshow img').each(function() {
    $(this).load(function() {
      //do stuff
    });
 });
});

Test the above code at http://jsbin.com/aqiki4

Ninja Dude