daniel.tosaba
daniel.tosaba

Reputation: 2563

jquery fadeOut callback functions not working

I found it in Jquery documentation that fadeOut() accepts callback function but in my case that function is not executing?? Take a look:

$("div.icon").stop(0,0).fadeOut(250,function(){
    $("div.expanded").stop(0,0).fadeIn(250);    
});

$("div.expanded").stop(0,0).fadeOut(250,function(){
    $("div.icon").stop(0,0).fadeIn(250);
});

Do you guys see something that I am missing here??

Many thanks

Upvotes: 0

Views: 316

Answers (2)

altschuler
altschuler

Reputation: 3922

Check out this fiddle: http://jsfiddle.net/jx8hn/

Did you by any chance set opacity:0 on .expanded? Because then it wont fadeIn. In the fiddle i set display:none which seems to work.

Upvotes: 1

Starx
Starx

Reputation: 78981

Omit the stop(), you dont need that. It only stop the animation prematurely.

Upvotes: 1

Related Questions