jquery - fadeOut, addClass to background then fadeIn -


i'm trying add fade in , fade out effect change of background of div lies fixed under main content, when user clicks buttons content, background changes it: works.

i tried add css transitions firefox doesn't seem support them background change.

then tried code doesn't make need. think i'm missing something, can suggest better sequence backgrounds change softly? tried delay(1000), again, fails fade changed backgrounds.

what problem? change of image happens right after click, before fadeout.

jquery('.button').click(function() {     jquery('#home-wrapper').fadeout(999);     jquery('#home-wrapper').removeclass('default_background');     jquery('#home-wrapper').addclass('filter_music').fadein(999); }); 

you need use callback parameter of fadeout class changed after animation ends. try this:

jquery(function($) {     $('.button').click(function() {         $('#home-wrapper').fadeout(999, function() {             $(this).removeclass('default_background').addclass('filter_music').fadein(999);         });     }); }); 

Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -