我对jquery相当新,并且仍然在寻找我的方式。一旦将图像加载到特定的div中,我就会尝试执行一个函数。
这是我的代码。
$('#advanced-slideshow img').load(function() {
var idx = $('#mycarousel li a.activeSlide').data('index') - 2;
carousel.scroll(idx);
return false;
});
我想要的是每次将图像加载到div中,#advanced-slideshow我希望我的函数能够执行。
对此的任何帮助都会很棒!
答案 0 :(得分:10)
$(function() {
$('#advanced-slideshow img').each(function() {
$(this).load(function() {
//do stuff
});
});
});
上测试上述代码