Jump to content

Display=none/block Problem With Ie6+


muncken
 Share

Recommended Posts

Hi,I have designet a menu tree class that outputs a menu with optional submenus available. When submenus (childs) are added to a menu link (parent), a submenu div will pop up when clicking the parent link. I use a simple javascript combined with css style.display property that checks the current style of the submenu; if block, set display to none and if none, set display to block.That works brilliant in FF and Safari etc. (as usual), but when it comes to IE, it crashes. I am experiencing serious troubles trying to fix this very IE-bug.All relevant css and html can be viewed here: http://test.muncken.dk/test_menu.phpThanks,Kasper

Edited by kasper munck
Link to comment
Share on other sites

Run your webpage through an html validator and fix your HTML errors, it might be contributing to your problem. Also, instead of using:

<ul>  <li><a class="menuParent" href="java script:toggleSubmenu('submenu_1');" title="Parent 1">Parent 1</a>	<div class="menuSubmenu" id="submenu_1" style="display:none;">	  <li><a class="menuChild" href="?id=1⊂=1" title="Child 1.1">Child 1.1</a></li>	  <li><a class="menuChild" href="?id=1⊂=2" title="Child 1.2">Child 1.2</a></li>	  <li><a class="menuChild" href="?id=1⊂=3" title="Child 1.3">Child 1.3</a></li>	</div>  </li></ul>

Nest the unordered list correctly, and use the second parent <li> instead of <div> to hide the child list.

<ul>  <li><a class="menuParent" href="java script:toggleSubmenu('submenu_1');" title="Parent 1">Parent 1</a></li>  <li class="menuSubmenu" id="submenu_1" style="display:none;">	<ul>	  <li><a class="menuChild" href="?id=1⊂=1" title="Child 1.1">Child 1.1</a></li>	  <li><a class="menuChild" href="?id=1⊂=2" title="Child 1.2">Child 1.2</a></li>	  <li><a class="menuChild" href="?id=1⊂=3" title="Child 1.3">Child 1.3</a></li>	</ul>  </li></ul>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...