var elm = (this).parents(".leftbox:first"); elm.animate({height:"hide",opacity:"hide"}, 350); setTimeout(function() { elm.remove(); }, 350);
On Fri, Jul 31, 2009 at 7:08 PM, bittermonkey <brakes...@gmail.com> wrote: > > So is there a way I can execute the slide-fade effect, then remove the > element from DOM after the animation? > > On Jul 31, 12:06 pm, waseem sabjee <waseemsab...@gmail.com> wrote: > > here is a chain of animation > > $(this).parents(".leftbox:first") > > .animate({opacity: 0.5}, 350) > > .animate({opacity: 0}, 350) > > .remove(); > > > > you are actually chaining your events to occur one after the other on a > > specific element or group of elements > > > > in the first piece of code you shared you. it would want to remove the > > element as it animates, not after. > > > > On Fri, Jul 31, 2009 at 5:59 PM, bittermonkey <brakes...@gmail.com> > wrote: > > > > > Please tell me why the remove() doesn't work from this call: > > > $(this).parents(".leftbox:first").animate({height:"hide", > > > opacity:"hide"}, 350, "", function(){$(this).remove()}); > > > > > while this one works: > > > $(this).parents(".leftbox:first").animate({height:"hide", > > > opacity:"hide"}, 350).remove(); > > > > > Thanks in advance. >