Hi, I''m new here - looking to toggle the visibility of 5 divs as below with 5 links - is there an easy lean way to do it that uses events? It also needs to hide the currently visible one? more of a switch rather than toggle. <html> <body> <a toggle1div1 /> <a toggle1div2 /> <a toggle1div3 /> <a toggle1div4 /> <a toggle1div5 /> <div1 (visible on load) /> <div2 (hidden) /> <div3 (hidden) /> <div4 (hidden) /> <div5 (hidden) /> Thanks, Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Chris, Please search through the archives before posting requests; this topic has been covered many times over. The most recent, I believe is called "One content at a time - Effect.toggle", and goes back to Dec 28. -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Chris, On 1/10/07, chris <bikkies-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > I''m new here - looking to toggle the visibility of 5 divs as below with > 5 links - is there an easy lean way to do it that uses events? It also > needs to hide the currently visible one? more of a switch rather than > toggle.If these are your only specifications then there is no need to get fancy with a big library. No need for overkill here. Below I''ve attached a sample that does what you''ve specified. Can I also suggest you take a look at the following link if you are interested in learning more about JavaScript <URL: http://www.jibbering.com/faq/#FAQ3_1> Peter ------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>toggler test</title> <script type="text/javascript"> var current = ''one'' function show(id) { document.getElementById(current).style.visibility = ''hidden''; document.getElementById(id).style.visibility = ''visible''; current = id; } </script> </head> <body> <ul> <li><a href="#" onclick="show(''one''); return false;">show one</a></li> <li><a href="#" onclick="show(''two''); return false;">show three</a></li> <li><a href="#" onclick="show(''three''); return false;">show three</a></li> </ul> <div id="one">one</div> <div id="two" style="visibility:hidden;">two</div> <div id="three" style="visibility:hidden;">three</div> </body> </html> -- JavaScript for Rails - http://forkjavascript.org/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---