Drop Down Menu / Posts /

Selected option for one of the ddmenus so that it is already open upon page load?

29
Is there a quick change that I can make to the script that would enable the first menu to be open when the page first loads and then operate normally thereafter?
msamek  10 years ago   viewed: 11941    

2 Answers

2
Good question. 
Yes it is possible with the following code added to your page (either in the head section of at the end of your page):
<script type="text/javascript"> function eventFire(el, etype) { if (el.fireEvent) { (el.fireEvent('on' + etype)); } else { var evObj = document.createEvent('Events'); evObj.initEvent(etype, true, false); el.dispatchEvent(evObj); } } function openTheFirstMenuItem() { var item1 = document.getElementById("ddmenu"); if (item1 && ddmenu) { item1 = item1.getElementsByTagName("li")[0]; eventFire(item1, "mouseover"); } else setTimeout(arguments.callee, 50); } openTheFirstMenuItem(); </script>
Milo   10 years ago
0
Just in case it depends upon the template that I'm using,  it was #3 of the drop down menus.  I would like for the first sub menu to be open upon page load but operate normally thereafter.
msamek
  10 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: