Javascript 命令jquery函数在另一个函数完成后执行
我有一个函数,当运行时,在我的页面上设置一个div的动画并删除一个类,但是我想做的是在高度动画的末尾删除这个类,这在jQuery中可能吗Javascript 命令jquery函数在另一个函数完成后执行,javascript,jquery,Javascript,Jquery,我有一个函数,当运行时,在我的页面上设置一个div的动画并删除一个类,但是我想做的是在高度动画的末尾删除这个类,这在jQuery中可能吗 var el = $(this).find('ul li'); var img = $(this).find('ul li img'); $(this).removeClass('active'); //return false; el.animate({hei
var el = $(this).find('ul li');
var img = $(this).find('ul li img');
$(this).removeClass('active');
//return false;
el.animate({height:'135px'}, 500);
el.css({
'background-position':'top left',
'background-size' : 'auto auto'
});
$(this).find('ul li img').animate({height:'270px'}, 500);
$(this).animate({height:'135px'}, 500);
img.attr('src', function(i, value) {
return value.substring(28);
});
动画完成后,将运行一个
complete
函数。根据,您可以这样使用它:
el.animate({height:'135px'}, 500, function() {
//code to run when complete goes here
});
在.animate函数中使用如下完整调用:
complete: function() { your func u wanna call when ani is complete..; }
使用动画回调函数,在那里设置逻辑