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

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -