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
Post a Comment