PDA

View Full Version : SDMENU - child expansion, with external menu script



redfive
10-08-2007, 08:00 PM
1) Script Title:
sdmenu

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

3) Describe problem:
Alright. First, fantastic script... really cool. Thanks kindly to the creators.

My issue is: How do I get the appropriate child menu to expand depending on the current page, considering I have placed the script in an external javascript file and not in each page independently? (There are 75+pages on this site, so every time we add a page I do not wish to check-out and change 75 files :))

Example: if you were to navigate to this page, http://www.earlylearning.ubc.ca/SDPP/ , you will see that the appropriate child menu at left is not expanded, and looks like this at present:

http://redfivemarketing.com/etc/helpmenu/notexpanded.gif


Now if you were to navigate to this page from the main page, because we have turned on the menu cookie it would look like this:

http://redfivemarketing.com/etc/helpmenu/expanded.gif

The question is, how to force the proper expansion of the appropriate child menu, instead of relying on a cookie to merely bring up the previous state of the menu?

If a user navigates to the subsection directly, we wish to have the menu be expanded as it should be. I can see how this is done if you paste the menu coding script into every page, but we have called it from one external script like this:

<script type="text/javascript" src="../menu.js"></script>
... and on the menu.js file, each html line in the sdmenu is returned via a document.write.

Any ideas?? Many thanks for taking the time to consider our issue. :)

redfive
10-12-2007, 12:40 AM
Bump...

Also, I'm wondering if there would be a straightforward way to create mouseover pop-up submenus, based on this sdmenu, instead of the expansion effect. So the expansion would only come into play when a page in that section is selected.

Anyone know best way to incorporate mouseover popup for submenus here??

cheers :)

redfive
10-13-2007, 06:06 PM
Can anyone help me with this?

Ictinus
10-14-2007, 01:05 AM
redfive,
To answer your first question... try this.

On each page that you want to have the menu open a specific submenu, execute the sdmenu function 'expandMenu' (passing it the submenu you want to expand), at the end of the onload event for that page.

You can do this by either knowing which position in the menu the submenu is:

var targetMenu = myMenu.submenus[4];
myMenu.expandMenu(targetMenu);

Or give each submenu an id and get that submenu before passing it:

var targetMenu = document.getElementById('SocialInclusion');
myMenu.expandMenu(targetMenu);

You probably want to set 'Remember = False' for the menu.

For the second question... you would need to modify the sdmenu script so that the init function didn't assign 'toggleMenu' to the onClick event, but instead 'popped it up'. For that part I suggest you take a look at some of the other menus which do this.

redfive
10-15-2007, 09:10 PM
Hi Ictinus,

First, thank you kindly for this advice! I am however having difficulties even in part 1 to get one section to expand. hmm...

This is quite complex. I would really like to pay you a consulting/development to get the menu working the intended way, including integrating a mouseover popup? If so, it would be greatly appreciated... please feel free to email me at josh a.t redfivemarketing d0t com to discuss details. Thank you, and really hoping to hear from you as we're in a bit of a pinch. :)

cheers,
Josh