please help! I think this is very easy for you..

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

please help! I think this is very easy for you..

Post by prue_ »

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:

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);
 
 
 
 
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: please help! I think this is very easy for you..

Post by josh »

when im on the sublinks?
Post Reply