jQuery - delay and fadeout before remove -


i trying .delay() , .fadeout() .remove()

but delay , fadeout has no effect in remove

here code:

jquery("#container").delegate(".remove", "click", function (e) {     e.preventdefault();     var parent = jquery(this).data('parent');     jquery(this).closest('.' + parent).fadeout(1000).delay(1000).remove(); }) 

why not

jquery(this).closest('.' + parent).fadeout(1000, function(){     $(this).remove() }); 

you should make use of complete callback provided .fadeout() in case

jquery("#container").on("click", ".remove", function (e) {     e.preventdefault();     var $this = jquery(this), parent = $this.data('parent');     $this.closest('.' + parent).fadeout(1000).delay(1000).remove(); }) 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -