Accordion Menu / Posts /

Collapse Top Level Menu Item At Loading Time

13

I am a licensed customer.  I would like to have all the top level menu items collapsed at page loading time.  I have tried to add <script>amenu.close(false);</script> in the <head> section but it did not work.  I also tried to add width="0" at <ul> tag and it did not help either.  I then tried to add ids to <li>, such as <li id="top_a">, and used top_a.close(false) to control and it did not work either.  I am pasting my source code here.  Any help would be greatly appreciated:

<!DOCTYPE html>
<html>
<head>
<title>Accordion menu</title>
<link href="menu/accordionmenu.css" rel="stylesheet" type="text/css" />
<script src="menu/accordionmenu.js" type="text/javascript"></script>
<script>amenu.close(false); top_a.close(false);  top_b.close(false);  top_c.close(false);
</script>
</head>

<body>

<p>SAMPLE ACCORDION MENU</p>
<div id="acdnmenu">
<ul>
<li id="top_a"><a href="#">Top A</a>
 <ul>
  <li>Sub A1</li>
     <li>Sub A2</li>
 </ul>
</li>
<li id="top_b"><a href="#">Top B</a>
 <ul>
  <li>Sub B1</li>
     <li>Sub B2</li>
 </ul>
</li>
<li id="top_c"><a href="#">Top C</a>
 <ul>
  <li>Sub C1</li>
     <li>Sub C2</li>
 </ul>
</li>
</ul>
</div>

</body>
</html>

Julia L  10 years ago   viewed: 5057    

   

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: