September 1, 200818 yr Hey everyone. I found this Javascript online. The only problem is that it doesn't automatically collapse the paragraph once you click another link to open another hidden paragraph. Does anyone know how to complete this Javascript so that the the open paragraph will collapse once another link is clicked to expand? JAVASCRIPT function toggleMe(a){ var e=document.getElementById(a); if(!e)return true; if(e.style.display=="none"){ e.style.display="block" } else { e.style.display="none" } return true; } HTML for each link to open paragraphs <input type="button" class="button" onclick="return toggleMe('alright')" value="Alright" /> Thanks for any help you can provide. Dave
September 1, 200818 yr If you're after the accordian effect you could try jQuery. Really lightweight too!
September 1, 200818 yr If you are indeed referring to an accordion, here are a few good one's you can use rather than fiddling around with javascript by yourself. Accordion v2.0 JS/CSS Accordion Simple Accordion
September 1, 200818 yr Author The accordion is similar to what I had in mind, but not exactly. Let me expand a bit more on the desired effect. I have a nav system setup on the right side of my page. I want the hyperlinks/button to trigger a show/hide accordion effect with <p> content that exists in the content portion of the page, which is located centered and to the left of the right nav system. Here is the page so far, maybe this will help clarify. http://www.db-elements.com/ahimsa/blake_ba...ndex_w_js2.html If you click, for example, "Alright" in the right nav, the content for that link will appear under the links panel. But if you click the link right below it, it won't collapse the previous content that was open. I would like to have the accordion effect take place when someone clicks on the next link. Any ideas? If not, I will probably go with the accordion effects you have suggested. This was the initial idea, as you can see by the remaining links in the content area, which have the same click & show effect for the paragraphs, but again, they will not collapse unless you manually click the link again. Thanks for the help, by the way. Greatly appreciated from a newbie. Dave
September 5, 200818 yr I think you mean drawers. Here an example of what you mean (I think) - www.snubcommunications.com/iceland/iceland-old.html
February 7, 200917 yr Hi, found a great post on a expand collapse, show/hide script at http://www.alohatechsupport.net/webdesignmaui/ and though I'd share. Have fun.
Create an account or sign in to comment