rquintal Posted October 25, 2006 Share Posted October 25, 2006 I need some help with the following code found on 'A List Apart': startList = function() {if (document.all&&document.getElementById) {navRoot = document.getElementById("nav");for (i=0; i<navRoot.childNodes.length; i++) {node = navRoot.childNodes[i];if (node.nodeName=="LI") {node.onmouseover=function() {this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace (" over", ""); } } } }}window.onload=startList; The code is for a hybrid css dropdown menu. All is well when I use the code as provided. What I would like to add is a delay in hiding the sub-menu (node.onmouseout=...). I can't get a setTimeout to work. Any suggestions would be appreciated. Thank you. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 30, 2006 Share Posted October 30, 2006 You should be able to do something like this: function menu_mouseout(el){ el.className=el.className.replace (" over", "");}...node.onmouseout=function() { window.setTimeout("menu_mouseout(this)", 500); //execute after 500 milliseconds} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now