Jump to content

Changing the Var Delay Hide (JavaScript Code)


Xtremer360

Recommended Posts

I'm wanting to change the var delay hide from 500 to something like infinite so that my nav bar will when one of the menus is click the sub menus will stay up until another menu is selected.

 

// Edit the dimensions of the below, plus background color-->
print '<ilayer width=1010 height=20 name="dep1">';
print '<layer name="dep2" width=1010 height=20>';
print '</layer>';
print '</ilayer>';
print '<div id="describe" onClick="clear_delayhide()" onMouseout="resetit(event)"></div>';
?>

<script language="JavaScript1.2">

/*
Tabs Menu (Click)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.

submenu[0]='<font size="2" face="Verdana"><b><a href="singles.php" target="main">Singles</a> | <a href="tagteams.php" target="main">Tag Team</a> | <a href="stables.php" target="main">Stables</a> | <a href="champions.php" target="main">Champions</a></b></font>'
submenu[1]='<font size="2" face="Verdana"><b><a href="upcomingshow.php" target="main">Upcoming Show</a> | <a href="results.php" target="main">Recent Show Results</a> | <a href="showarchive.php" target="main">Show Archives</a> | <a href="tickets.php" target="main">Tickets</a></b></font>'
submenu[2]='<font size="2" face="Verdana"><b><a href="photos.php" target="main">Show Photos</a> | <a href="kowphotos.php" target="main">KOW Photos</a> | <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=380983565">Myspace</a></b></font>'
submenu[3]='<font size="2" face="Verdana"><b><a href="contact.php" target="main">Contact KOW</a> | <a href="titlehistory.php" target="main">History of Champions</a></b></font>'

//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

/////No need to edit beyond here

var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""

function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.