/    Sign up×
Community /Pin to ProfileBookmark

Drop down menu HELP!

first off the problem is that i have a 1 layer horizontal drop down menu. every time i click into a page from the sub menu it disappears which makes navigation hard for users. Im looking for help with the javascript below to help the menu stay up when navigating through the section of sub menus. and change accordingly when the sub menu is changed and help with this will be greatly appreciated.

var mastertabvar=new Object()
mastertabvar.baseopacity=0
mastertabvar.browserdetect=””

function showsubmenu(masterid, id){
if (typeof highlighting!=”undefined”)
clearInterval(highlighting)
submenuobject=document.getElementById(id)
mastertabvar.browserdetect=submenuobject.filters? “ie” : typeof submenuobject.style.MozOpacity==”string”? “mozilla” : “”
hidesubmenus(mastertabvar[masterid])
submenuobject.style.display=”block”
instantset(mastertabvar.baseopacity)
highlighting=setInterval(“gradualfade(submenuobject)”,50)
}

function hidesubmenus(submenuarray){
for (var i=0; i<submenuarray.length; i++)
document.getElementById(submenuarray[i]).style.display=”none”
}

function instantset(degree){
if (mastertabvar.browserdetect==”mozilla”)
submenuobject.style.MozOpacity=degree/100
else if (mastertabvar.browserdetect==”ie”)
submenuobject.filters.alpha.opacity=degree
}

function gradualfade(cur2){
if (mastertabvar.browserdetect==”mozilla” && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (mastertabvar.browserdetect==”ie” && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (typeof highlighting!=”undefined”) //fading animation over
clearInterval(highlighting)
}

function initalizetab(tabid){
mastertabvar[tabid]=new Array()
var menuitems=document.getElementById(tabid).getElementsByTagName(“li”)
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute(“rel”)){
menuitems[i].setAttribute(“rev”, tabid) //associate this submenu with main tab
mastertabvar[tabid][mastertabvar[tabid].length]=menuitems[i].getAttribute(“rel”) //store ids of submenus of tab menu
if (menuitems[i].className==”selected”)
showsubmenu(tabid, menuitems[i].getAttribute(“rel”))
menuitems[i].getElementsByTagName(“a”)[0].onmouseover=function(){
showsubmenu(this.parentNode.getAttribute(“rev”), this.parentNode.getAttribute(“rel”))
}
}
}
}

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @sundance453 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...