please help! I think this is very easy for you..
Posted: Wed Jun 17, 2009 11:12 pm
Please help me... when I'm on the sublinks... I just want the links to remain visible... how can I do this? thanks
here's the code:
here's the code:
Code: Select all
var delay = 500; /* milli seconds */
function attachHooks() {
var menu = document.getElementById("mainMenu");
var menuItems = menu.getElementsByTagName("li");
currentHover = menuItems[0];
for (var i = 0; i < menuItems.length; i++) {
menuItems[i].onmouseover = function () {activateMenuWithDelay(this);};
menuItems[i].onmouseout = function () {deactivateMenuWithDelay(this);};
}
}
function activateMenuWithDelay(ele) {
if(ele.timer) {
clearTimeout(ele.timer);
}
ele.timer = setTimeout(function(){activateShowMenu(ele)}, delay);
}
function activateShowMenu(ele) {
var parent = ele;
parent.className = "showMenu";
}
function deactivateMenu(ele) {
var parent = ele;
parent.className = " ";
}
function deactivateMenuWithDelay(ele) {
if(ele.timer) {
clearTimeout(ele.timer);
}
ele.timer = setTimeout(function(){deactivateMenu(ele)}, delay);
}
function initMenuDelay() {
attachHooks();
deactivateMenu();
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(attachHooks);