View Full Version : sdmenu auto expand from navigation

11-27-2009, 06:25 AM
1) Script Title: sdmenu.js

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/slashdot.htm

3) Describe problem:
I have the menu working perfectly. What I would like to do is have a menu item expand automatically when the main sub navigation is clicked.

I have a page called services.htm which has the sdmenu on it collapsed with four categories:
1. Landscape Consultancy
2. Landscape Design
3. Landscape Construction
4. Landscape Maintenance

When you click on any of the 4, the category's text appears. When you click on another it expands and the first one collapses. All working beautifully.

I also have a main menu which has the Services link with the four categories as dropdowns on rollover (not using sdmenu for that). What I would like it to do is when you click on Landscape Consultancy in the main menu drop down for the services page to load and the 1. Landscape Consultancy to expand. And the same if you click on any of the other 3 in the main nav dropdown.

I have tried various things like:

<a href="JavaScript:('/services.htm', var targetMenu = document.getElementById('consult'); myMenu.expandMenu(targetMenu);)">LANDSCAPE CONSULTANCY</a>

<a href="/services.htm" onclick="var targetMenu = document.getElementById('consult'); myMenu.expandMenu(targetMenu);">LANDSCAPE CONSULTANCY</a>
(not sure if I did that [CODE] thing properly I'm a newbie - ha, looks like I did!)

I hope someone can help. While my CSS and HTML is passable my Javascript is non existent so please be very specific about where I should put the code and any tags that need to go around it.

Thanking you in advance, I'm at my wits end.

11-29-2009, 11:19 AM
Seems nobody likes a challenge