Help - Search - Members - Calendar
Full Version: Drop down Navigation menu help...
HTMLHelp Forums > Web Authoring > General Web Design
jamylovesong
Hello,

I currently have a drop down navigation menu on the top of my site, which is set to drop-down when you mouse over the main title link named "navi". In the menu are several links to the sections of my site. Is there any way to add sub-sections to these links that drop down to the side?

Sort of like a windows start menu...

Here is the code for the JSdrop-down menu (anylink.js)...

var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

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

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}


And here is the anylink.css file...

.anylinkcss
{
position:absolute;
visibility: hidden;
border:0px ridge white;
font:normal 8pt Times New Roman;
color: FFFFFF;
line-height: 18px;
z-index: 100;
background-color: #000000;
width: 70px;
cursor: url("normal.cur");
}

.anylinkcss
a
{
width: 70px;
display: block;
text-indent: 0px;
border-bottom: 0px solid white;
padding: 4px 0;
text-decoration: none;
font-weight: normal;
text-align: center;
text-indent: 0px;
color: #ffffff;
cursor: url("normal.cur");
}

.anylinkcss
a:hover
{
/*hover background color*/
background-image: url(hg_patrnset.gif);
color: #ffffff;
text-decoration: oblique;
cursor: url("dancingmoogle.ani");

}

and this is in the body of the page...

<html>

<head>

<link rel="stylesheet" type="text/css" href="anylink.css" />

<script type="text/javascript" src="anylink.js">

</head>

<body>

<a class="one" href="welcome.html" target="showframe" onMouseover="dropdownmenu(this, event, 'anylinkmenu1')">   navi</a>

<div id="anylinkmenu1" class="anylinkcss">

<a href="neo3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">News</a>
<a href="bio3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">Biography</a>
<a href="words3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">Words</a>
<a href="paint3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">Paintings</a>
<a href="draw3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">Drawings</a>
<a href="electro3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">Electronica</a>
<a href="links3.html" target="showframe" onMouseover="playHome()" onClick="playClick()">Links</a>
<br>
</div>

</body>

</html>


Any help would be greatly appreciated...
Darin McGrew
Can you provide the URL (address) of a document that demonstrates the problem?
pandy
Why don't you just find another ready-made menu with that functionality built in? Here's one.
http://www.brothercake.com/site/products/menu/
jamylovesong
QUOTE(Darin McGrew @ Jan 26 2007, 07:39 PM) *

Can you provide the URL (address) of a document that demonstrates the problem?



Thanks for the response. I think I am going to try something else.
Frederiek
QUOTE(pandy @ Jan 27 2007, 02:34 AM) *

Why don't you just find another ready-made menu with that functionality built in? Here's one.
http://www.brothercake.com/site/products/menu/

Or Eric Meyer's Pure CSS menus
pandy
It was a cool demo once, but since it doesn't work in IE I wouldn't use it as navigation. Better to use a menu that builds on the same concept but does work in IE, for example Suckerfish.
http://www.htmldog.com/articles/suckerfish/
jamylovesong
QUOTE(pandy @ Mar 15 2007, 04:57 AM) *

It was a cool demo once, but since it doesn't work in IE I wouldn't use it as navigation. Better to use a menu that builds on the same concept but does work in IE, for example Suckerfish.
http://www.htmldog.com/articles/suckerfish/



Thank You so much. The Suckerfish one was perfect. You're a peach!
wub.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.