1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
function buildsubmenus(){
var liTags = $('menu').getElementsByTagName("ul")[0].childNodes;
var currentNumItemSel = '';
var defaultSelElem = '';
for (var i = 0; i < liTags.length; i++){
showFirstNav(liTags[i],i);
if(liTags[i].className == 'selected'){
defaultSelElem = i;
}
}
function showFirstNav(item2Show,numItem){
item2Show.onmouseover = function(){
if(currentNumItemSel){
currentItemSel = liTags[currentNumItemSel].childNodes;
if(currentItemSel[3]){
hideItem(currentItemSel[3]);
liTags[currentNumItemSel].className = "";
}
}else{
liTags[defaultSelElem].className = "";
hideItem(liTags[defaultSelElem].childNodes[3]);
}
currentNumItemSel = numItem;
currentNode = item2Show.childNodes;
if(currentNode[3]){
showItem(currentNode[3]);
liTags[currentNumItemSel].className = "selected";
showNextNav(currentNode[3].childNodes);
}
}
}
function showNextNav(nnElem){
for (var i = 0; i < nnElem.length; i++){
nextItem = nnElem[i].childNodes;
if(nextItem.length > 1){
nnElem[i].onmouseover = function(){
showItem(this.childNodes[1]);
}
nnElem[i].onmouseout = function(){
hideItem(this.childNodes[1]);
}
}
}
}
function hideItem(navItem){
navItem.style.display = "none";
}
function showItem(navItem){
navItem.style.display = "block";
}
} |
Partager