Log in

View Full Version : vertical menu display problem



dheema
10-14-2011, 09:18 AM
hi
i have copy the "Urban Gray Accordion Menu" in this website only
http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-urban.htm
and i have customised it ,i have been through all the instruction several time,but am not having the result i want.according to the example when the mouse move over the header containing sub menus,the sub menu should automatically appear.but with the modification i did.when the mouse in on the first header another header sub menus appear..hope you are understanding my problem.here is the changes i did and my code..it for my college project,please help



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

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

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>

<script type="text/javascript">

ddaccordion.init({
headerclass: "headerbar", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group
revealtype: "mouseover", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc] [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})

</script>

<style type="text/css">

.urbangreymenu{
width: 190px; /*width of menu*/
}

.urbangreymenu .headerbar{
font: bold 13px Verdana;
color: white;
background: #606060 url(arrowstop.gif) no-repeat 8px 6px; /*last 2 values are the x and y coordinates of bullet image*/
margin-bottom: 0; /*bottom spacing between header and rest of content*/
text-transform: 0;
padding: 7px 0 7px 31px; /*31px is left indentation of header text*/
}

.urbangreymenu .headerbar a{
text-decoration: none;
color: white;
display: block;
}

.urbangreymenu ul{
list-style-type: none;
margin: 0;
padding: 0;
margin-bottom: 0; /*bottom spacing between each UL and rest of content*/
}

.urbangreymenu ul li{
padding-bottom: 2px; /*bottom spacing between menu items*/
}

.urbangreymenu ul li a{
font: normal 12px Arial;
color: black;
background: #E9E9E9;
display: block;
padding: 5px 0;
line-height: 17px;
padding-left: 8px; /*link text is indented 8px*/
text-decoration: none;
}

.urbangreymenu ul li a:visited{
color: black;
}

.urbangreymenu ul li a:hover{ /*hover state CSS*/
color: white;
background: black;
}

</style>

<body>

<div class="urbangreymenu">

<h3 class="headerbar"><a href="#">Home</a></h3>

<h3 class="headerbar"><a href="#">Latest News</a></h3>

<h3 class="headerbar"><a href="#">Daily Market Quotes</a></h3>
<ul class="submenu">
<li><a href="#" >Official Market</a></li>
<li><a href="#">Dem Market</a></li>
</ul>

<h3 class="headerbar"><a href="#">Application Forms(DownLoad)</a></h3>

<h3 class="headerbar"><a href="#">Others</a></h3>
<ul class="submenu">
<li><a href="#" >Useful Links</a></li>
</ul>

<h3 class="headerbar"><a href="#">Contact Us</a></h3>


<h3 class="headerbar"><a href="#">LogIN</a></h3>


<h3 class="headerbar"><a href="#">LogOut</a></h3>


<h3 class="headerbar"><a href="#">Our Profile</a></h3>
<ul class="submenu">
<li><a href="#" >CMB Profile</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Staff Profile</a></li>
</ul>

</div>

</body>

</html>

please help sooooon

thanks:confused::confused::confused::confused:

macieQ82
10-14-2011, 09:38 AM
Hi there,

If You remove main menu element (h3) which don't have any submenu (ul with li) everything will work fine.

It's not a problem on Your modification but in javascript menu code.

The easiest way of fixing it, is to put bellow code under each h3 element without submenu

<ul class="submenu"><li style="display: none;">&nbsp;</li></ul>

dheema
10-14-2011, 09:49 AM
hi macieQ82

thanks a lot it working fine..

thanks thanks:):):):)

macieQ82
10-14-2011, 09:54 AM
Your welcome