Drop-down Navigation Generator Script
I’ve recently made a small script that you could use to automatically generate a drop-down navigation from an existing list-based navigation on your web page. The script will detect the navigation with the ID you provide, generate a drop-down equivalent and insert it within an element you specify. Choosing any option of the drop-down list would send you to its corresponding link (as seen on many sites).
To start using the script in your own page, just modify the function calls within the init function (further explanation can be found in the source code). You could generate as many drop-down navigations as you want, but you probably won’t need more than one.
Notes:
- The script will not work with multi-level lists, because I couldn’t find a way to make a semantic multi-level drop-down list. (any suggestions?)
- If one of your list’s elements doesn’t contain a link, the script will not work properly.
- The script has been tested under Internet Explorer 6, Firefox 1.5/2.0, Opera 9 and Safari 2.0
Download script (sample included)
Nice work, Mashhoor. Just tested in Safari 2.0.4 and it appears to work without a problem, so you can add that to your compatibility list.
Thanks Egor.
(sorry for the late response, but my e-mail didn’t notify me about this comment for some reason)