PDA

View Full Version : having 2 accordion menus on one page



Irishcash33
12-08-2008, 03:26 PM
Hi,
I have 2 accordion menus from dynamicdrive on my page. I want both of them to be open on page load and be independent of eachother. Right now one is open on load, and if you click on the second one to expand it, the first one closes. How can I make it so both are open and one doesn't close when you open the other one
site (http://www.clashgraphicdesign.com/CRN/crn_local_homepage.html)
Any suggestions?

Thanks

jscheuer1
12-08-2008, 06:04 PM
In future, please post about Dynamic Drive Scripts in the Dynamic Drive Scripts Help section here where I've moved this thread, and:

Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Irishcash33
12-08-2008, 06:19 PM
Here is the link to the DD menu (http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-apple.htm)

jscheuer1
12-08-2008, 06:53 PM
First of all, get rid of this:


<script type="text/javascript">
<!--
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
//-->
</script>

You are not using it any longer and it causes an error.

Now, if you look at the main script page for accordion:

http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

You will see that in order to have two accordions, you need to have two inits. So you really have only one menu on your page, it's just spread out between two places. (see Step 1 on the above demo page)

However, it's not made clear, but I imagine that in order for the inits to address two separate menus, each must use unique headerclass and contentclass class names. The css style rules for these may be the same, so that the look of both menus can be the same, but it looks like you need unique names used with separate inits to get unique menus. These unique class designation would then be reflected in the two menu's markup, with one set being used in one menu's markup, and the second set being used in the other menu's markup.

Irishcash33
12-09-2008, 04:53 PM
Thanks!!
This works fine. I made a second inits and renamed the header and content classes, and it seems to work.

Thanks

Will