gert-jan.schulte-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org
2007-Jan-13 19:02 UTC
how to use an effect on multiple divs at once
Hi, I''m looking for an solution about how to use an effect on more than one div at a time... For example: i''ve got 10 div (div1, div2, etc) if I click one of those divs I want any other opened div to close. I''ve already to solve it by using arrays but it won''t work. <a onClick="Effect.BlindUp(alldivs); Effect.SlideDown(''div1'')">Div1</a> Thanks already, Gert-Jan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You can do: [''array'',''of'',''ids''].each(function(e){ Effect.BlindUp(e) }); best, thomas Am 13.01.2007 um 20:02 schrieb gert-jan.schulte-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org:> > Hi, > > I''m looking for an solution about how to use an effect on more than > one > div at a time... For example: i''ve got 10 div (div1, div2, etc) if I > click one of those divs I want any other opened div to close. I''ve > already to solve it by using arrays but it won''t work. > > <a onClick="Effect.BlindUp(alldivs); Effect.SlideDown > (''div1'')">Div1</a> > > Thanks already, > Gert-Jan > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
write a function, call it whatever you want (called it "handledivclick()" in this example) that calls the effects for those elements... then call that function in the onclick event. (You could even pass in the name of the div you wanted to remain open into the function, then open that div after you loop through and close all 10 div''s) <script type="text/javascript"> handledivclick() { [your code to loop through array to close divs here] } </script> <a onClick="handledivclick();">Div1</a> On 1/13/07, gert-jan.schulte-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org <gert-jan.schulte-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org> wrote:> > > Hi, > > I''m looking for an solution about how to use an effect on more than one > div at a time... For example: i''ve got 10 div (div1, div2, etc) if I > click one of those divs I want any other opened div to close. I''ve > already to solve it by using arrays but it won''t work. > > <a onClick="Effect.BlindUp(alldivs); Effect.SlideDown(''div1'')">Div1</a> > > Thanks already, > Gert-Jan > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
... and it looks as if you''re running the effects in parallel, so div1 will close as it''s being opened, i.e. no net effect. Given your description, it sounds like you''re looking for an accordion effect. There have been several working examples posted to this group in the past. Do a search. TAG On Jan 13, 2007, at 12:13 PM, Thomas Fuchs wrote:> > You can do: > > [''array'',''of'',''ids''].each(function(e){ Effect.BlindUp(e) }); > > best, > thomas > > Am 13.01.2007 um 20:02 schrieb gert-jan.schulte-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org: > >> >> Hi, >> >> I''m looking for an solution about how to use an effect on more than >> one >> div at a time... For example: i''ve got 10 div (div1, div2, etc) if I >> click one of those divs I want any other opened div to close. I''ve >> already to solve it by using arrays but it won''t work. >> >> <a onClick="Effect.BlindUp(alldivs); Effect.SlideDown >> (''div1'')">Div1</a> >> >> Thanks already, >> Gert-Jan >> >> >>> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---