javascript - run animation then remove element -


i tring run simple animation remove div since lies on buttons can not click them after animation.

js

$(".intro").eq(0).delay(800).animate({"opacity":"0"},1000 ); 

i tried doing remove element after animation removes before.

$(".intro").eq(0).delay(800).animate({"opacity":"0"},1000 ).remove(); 

remove in animate function's callback:

$(".intro").eq(0).delay(800).animate({opacity: 0}, 1000, function() {   $(this).remove() }); 

alternatively, add complete function in option object:

$(".intro").eq(0).delay(800).animate({opacity: 0}, {duration: 1000, complete: function() {$(this).remove();}}); 

you can add more options it, easing example. check api doc


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -