Cascading Popup Menus v4.11

by Angus Turnbull - http://www.twinhelix.com. Updated: 11 December 2001.



Sets up a system of multilevel popup menus on a page. Be sure to check my site regularly for compatibility information, Frequently Asked Questions and new versions. Features of this script include:

Conditions of Use:

  1. This script is provided as-is, without a warranty of any kind, as although I strive to make it as compatible as possible I cannot guarantee it will work in all target environments, so test thoroughly.
  2. You may not redistribute this in any form, either intact or modified, without my consent.
  3. On sites that use this script, you should place a visible link to the splash page of my site, with a short description, for example: "DHTML / JavaScript provided by TwinHelix Designs". (Please don't link to individual pages within this site as my splash page detects browser capabilities). Also leave the my 'script name' comment in the source. These stop interested users emailing the webmaster asking how to acquire the scripts. If linking me doesn't suit your project...
  4. COMMERCIAL USERS: This script is 'donation-ware'. If you want to support this script and/or you are using this script as part of a commercial project, please consider making a donation via my site. After all, I have probably saved you several months developing, debugging and documenting a comparable script. Donors may take an optional exemption from a 'visible link' on the site, if that does not fit your site design.

Usage Instructions:

Most of the instructions are already in the source -- open this up with your favourite text editor and start customising. Before deploying this on your site, be sure to remove the comments! You can double or treble loading speed that way -- there's a handy utility in the Zip file to assist with this as well.

See my site for conditions of use, Frequently Asked Questions if you're stuck, compatibility information and new versions. If you are going to use this script, I would be grateful if you linked to my site somewhere, and left the comment in at the top of the source. My site is where I'll keep the most recent commented version. Also, try to employ a better sense of colour than I've used in this demonstration :)

Basically, to use this script cut and paste the script element and stylesheet into your page. You may wish to make the script element at least an external .JS file, which should speed loading times as people navigate; possibly do the same with the stylesheet.

Good luck! -- Gus


Version History:


Known Issues / Future Plans:

At the moment, NS6 and IE5 have a slightly different 'box models' i.e. whether borders show inside or outside items. I've implemented a fix that adjusts item size for NS6, but be aware that with CSS borders you can't have pixel-perfect positioning. Of course, you should definitely test in as many browsers as possible when deploying this menu - at least NS4 and IE. IE6 now can be made to render in compliance with the DOM spec by setting a strict doctype but you might as well just leave the script as-is.

Speaking of Netscape 6, there are still a few nasty bugs in that browser. If the contents of your items are bigger than the items themselves, occasionally it doesn't hide menus properly... sections remain onscreen after mouseout. So make sure your items are large enough for anything that they will contain! This also happens occasionally with transparent background colours... your mileage may vary on this one. As always, test thoroughly!

Text style changes may induce a little flicker in Netscape 4 as the layer contents have to be rewritten -- other browsers are OK for this as they allow manipulation of classes through the DOM. Also, the cursor changes from a hand to a pointer over the menus in NS4. This isn't a bug as such, you can still click anywhere to activate them. You just can't specify stylesheet cursors in NS4.

The mouseout and mouseover events are not entirely reliable in NS4, as sometimes it calls a mouseout, without a corresponding mouseover, and so on. IE and NS6 behave well. These events may also be called multiple times as the browser bubbles incidents of events within items, so probably don't use them for much more than status messages etc.

'Future Plans' is a little misleading as I'm suffering from scripter's block ;). Suggestions are always welcome...