开发者

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');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜