jQuery removeClass() callback function
is it possible to have a callback function for the removeClass() function in jQuery? I have the following code:
var pane = $(this).开发者_JS百科attr("rel");
var current = $('.active-pane');
current.fadeOut("slow").removeClass('active-pane');
$("#pane-"+pane).addClass('active-pane');
So basically I want current to fade out, then have the active-pane class removed, then once thats happened add the active-pane class to the new element. At the moment these events happen at the same time.
The .fadeout
method has a callback.
current.fadeOut("slow", function() {
current.removeClass('active-pane');
$("#pane-"+pane).addClass('active-pane');
});
精彩评论