FadeIn, FadeOut callback
I'm trying to make a simple Jquery script that will fade out all divs where the class is 'content'. And then afterwards fade in the div that is passed through the div variable. It works, in the sense that it fades out and fades in the correct divs when a button is clicked. However it seems like the callback is not working - ie the fadeIn occurs at the same time as the fadeOut. Whats wrong with this code? I've looked through the Jquery tutorials and stuff but can't see why the callback won't work. Cheers
$(document).ready(function() {
$(".buttons").click(function(event) {
var div = this.name;
$("#" + div).siblings(".content").fadeOut(1000, function() {
$("#" + div).fadeIn(1000);
});
});
});
尝试:
$("#"+div).siblings(".content").fadeOut(1000).fadeIn(1000);
链接地址: http://www.djcxy.com/p/21386.html
上一篇: jQuery fadeIn / fadeOut:无淡出动画
下一篇: FadeIn,FadeOut回调