Before I recreate the wheel, is there a easy way to destroy/remove a node from the html DOM? What I''m looking for is something like Effect.Fade or Effect.Puff, but after completion, it removes the element from the DOM entirely, instead of just setting the display style to none. Thanks!
On 5/27/05, David Teare <dteare-LXYvB7aEQDJCkLs28/y7ANBPR1lH4CV8@public.gmane.org> wrote:> Before I recreate the wheel, is there a easy way to destroy/remove a > node from the html DOM? What I''m looking for is something like > Effect.Fade or Effect.Puff, but after completion, it removes the element > from the DOM entirely, instead of just setting the display style to none.I was thinking that too. It would be nice if you could specify a callback for those methods. -- rick http://techno-weenie.net
Hi, In the next version of the effects, event handlers/callbacks will be included. See http://mir.aculo.us/demos/effects/effects2.html for a preview. Note the ''afterFinish'' event handler (e.g. the .Blind() effect): afterFinish: function(effect) { } Within the function, the expression effect.element returns the element. You can than use all the DOM functions you want on it. See the page source for the JS of the new effects. Currently they use Effect2.XXX, so you can use the old version and the new one at the same time. Thomas Am 27.05.2005 um 18:37 schrieb Rick Olson:> On 5/27/05, David Teare <dteare-LXYvB7aEQDJCkLs28/y7ANBPR1lH4CV8@public.gmane.org> wrote: > >> Before I recreate the wheel, is there a easy way to destroy/remove a >> node from the html DOM? What I''m looking for is something like >> Effect.Fade or Effect.Puff, but after completion, it removes the >> element >> from the DOM entirely, instead of just setting the display style >> to none. >> > > I was thinking that too. It would be nice if you could specify a > callback for those methods. > > > -- > rick > http://techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thanks a lot Thomas! Is the Effects2 code stable enough to start playing with? I''d hate to start using it if you''re planning a major refactoring.... Thomas Fuchs wrote:> Hi, > > In the next version of the effects, event handlers/callbacks will be > included. > See http://mir.aculo.us/demos/effects/effects2.html for a preview. > > Note the ''afterFinish'' event handler (e.g. the .Blind() effect): > > afterFinish: function(effect) { } > > Within the function, the expression effect.element returns the element. > You can than use all the DOM functions you want on it. > > See the page source for the JS of the new effects. Currently they use > Effect2.XXX, so you can use the old version and the new one at the same > time. > > Thomas > > Am 27.05.2005 um 18:37 schrieb Rick Olson: > >> On 5/27/05, David Teare <dteare-LXYvB7aEQDJCkLs28/y7ANBPR1lH4CV8@public.gmane.org> wrote: >> >>> Before I recreate the wheel, is there a easy way to destroy/remove a >>> node from the html DOM? What I''m looking for is something like >>> Effect.Fade or Effect.Puff, but after completion, it removes the >>> element >>> from the DOM entirely, instead of just setting the display style to >>> none. >>> >> >> I was thinking that too. It would be nice if you could specify a >> callback for those methods. >> >> >> -- >> rick >> http://techno-weenie.net >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Yeah, it is stable enough. There will be some changes to .Scale to support the V1-style "memory of original size", but the core won''t change too much. So, go ahead. Anyway, I think you should extend Prototype''s "Element" stuff to include an Element.Destroy(), and then call on Element.Destroy(effect.element) out of the afterFinish callback. Thomas Am 27.05.2005 um 19:34 schrieb David Teare:> Thanks a lot Thomas! > > Is the Effects2 code stable enough to start playing with? I''d hate > to start using it if you''re planning a major refactoring.... > > Thomas Fuchs wrote: > > >> Hi, >> >> In the next version of the effects, event handlers/callbacks will >> be included. >> See http://mir.aculo.us/demos/effects/effects2.html for a preview. >> >> Note the ''afterFinish'' event handler (e.g. the .Blind() effect): >> >> afterFinish: function(effect) { } >> >> Within the function, the expression effect.element returns the >> element. >> You can than use all the DOM functions you want on it. >> >> See the page source for the JS of the new effects. Currently they use >> Effect2.XXX, so you can use the old version and the new one at the >> same >> time. >> >> Thomas >> >> Am 27.05.2005 um 18:37 schrieb Rick Olson: >> >> >>> On 5/27/05, David Teare <dteare-LXYvB7aEQDJCkLs28/y7ANBPR1lH4CV8@public.gmane.org> wrote: >>> >>> >>>> Before I recreate the wheel, is there a easy way to destroy/ >>>> remove a >>>> node from the html DOM? What I''m looking for is something like >>>> Effect.Fade or Effect.Puff, but after completion, it removes >>>> the element >>>> from the DOM entirely, instead of just setting the display >>>> style to none. >>>> >>>> >>> >>> I was thinking that too. It would be nice if you could specify a >>> callback for those methods. >>> >>> >>> -- >>> rick >>> http://techno-weenie.net >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thanks again Thomas. Once I add this, how do I contribute it back to the community? It seems others are interested in it too.... Thomas Fuchs wrote:> Yeah, it is stable enough. There will be some changes to .Scale to > support the V1-style "memory of original size", > but the core won''t change too much. So, go ahead. > > Anyway, I think you should extend Prototype''s "Element" stuff to > include an Element.Destroy(), > and then call on Element.Destroy(effect.element) out of the > afterFinish callback. > > Thomas > > Am 27.05.2005 um 19:34 schrieb David Teare: > >> Thanks a lot Thomas! >> >> Is the Effects2 code stable enough to start playing with? I''d hate >> to start using it if you''re planning a major refactoring.... >> >> Thomas Fuchs wrote: >> >> >>> Hi, >>> >>> In the next version of the effects, event handlers/callbacks will >>> be included. >>> See http://mir.aculo.us/demos/effects/effects2.html for a preview. >>> >>> Note the ''afterFinish'' event handler (e.g. the .Blind() effect): >>> >>> afterFinish: function(effect) { } >>> >>> Within the function, the expression effect.element returns the >>> element. >>> You can than use all the DOM functions you want on it. >>> >>> See the page source for the JS of the new effects. Currently they use >>> Effect2.XXX, so you can use the old version and the new one at the >>> same >>> time. >>> >>> Thomas >>> >>> Am 27.05.2005 um 18:37 schrieb Rick Olson: >>> >>> >>>> On 5/27/05, David Teare <dteare-LXYvB7aEQDJCkLs28/y7ANBPR1lH4CV8@public.gmane.org> wrote: >>>> >>>> >>>>> Before I recreate the wheel, is there a easy way to destroy/ remove a >>>>> node from the html DOM? What I''m looking for is something like >>>>> Effect.Fade or Effect.Puff, but after completion, it removes the >>>>> element >>>>> from the DOM entirely, instead of just setting the display style >>>>> to none. >>>>> >>>>> >>>> >>>> I was thinking that too. It would be nice if you could specify a >>>> callback for those methods. >>>> >>>> >>>> -- >>>> rick >>>> http://techno-weenie.net >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >