FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Help please - menu delay (JavaScript)

 


sonam
Hi, I am beginer in JavaScript, and I need some help. I am create one CSS menu and submenu disapear in milisecond when is mose out. Now, I would like to put some delay for submenus. I see some menus using setTimeout, but I don't know how to use on my menu.

Here is part what I am using for IE.

Code:
navHover = function() {
   var lis = document.getElementById("mojmenu").getElementsByTagName("LI");
   for (var i=0; i<lis.length; i++) {
      lis[i].onmouseover=function() {
         this.className+=" iehover";
      }
      lis[i].onmouseout=function() {
         this.className=this.className.replace(new RegExp(" iehover\\b"), "");
         
      }
   }
}

trHover = function() {
var lis = document.getElementsByTagName("tr");
   for (var i=0; i<lis.length; i++) {
      lis[i].onmouseover=function() {
         this.className+=" iehover";
      }
      lis[i].onmouseout=function() {
         this.className=this.className.replace(new RegExp(" iehover\\b"), "");
         
      }
   }
}
if (window.attachEvent) window.attachEvent("onload", trHover);
if (window.attachEvent) window.attachEvent("onload", navHover);


Sonam
welshsteve
Hi sonam,

You could try using this toool - http://www.javabase.co.uk/Cerebellum/Cerebellum_generate.html
jabapyth
why are you messing with changing class names? all you need is
Code:
mymenu.style.visibility="hidden";
//or
mymenu.style.visibility="visible";

then to add a delay:
Code:
mymenu.onmouseout = function() {
setTimeout(function(){this.style.visibility = "hidden";}, 100)
}
sonam
Thanks welshsteve, but this site is not help me. I think jabapyth is on right way. jabapyth can you help me little bit more. I am remove second tr statment, and now I have only LI but I dont know where I must insert this two things what you recomend. Is this going in separate JS or in same, and where?

Thanks, Sonam
sonam
I still need help wiht this delay! Any idea how to solve this problem.

Sonam
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.