PDA

View Full Version : Glossy Accordion Menu



joebloggs2008
09-10-2008, 05:15 AM
1) Script Title:Glossy Accordion Menu

http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm

2) My Script:

<script type="text/javascript" src="jquery-1.2.2.pack.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: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //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: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "normal", //speed of animation: "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">

body {
background-color:#FFF8DC;
}

.glossymenu{
margin: 5px 0;
padding: 0;
width: 170px; /*width of menu*/
border: 1px solid orange;
border-bottom-width: 1;
}

.glossymenu a.menuitem{
background: black url(glossyback.gif) repeat-x bottom left;
font: 13px "Arial", "Trebuchet MS", Verdana, Helvetica, sans-serif;
color: orange;
display: block;
position: relative; /*To help in the anchoring of the ".statusicon" icon image*/
width: auto;
padding: 4px 0;
padding-left: 10px;
text-decoration: none;
}


.glossymenu a.menuitem:visited, .glossymenu .menuitem:active{
color: orange;
}

.glossymenu a.menuitem .statusicon{ /*CSS for icon image that gets dynamically added to headers*/
position: absolute;
top: 5px;
right: 5px;
border: none;
}

.glossymenu a.menuitem:hover{
background-image: url(glossyback2.gif);
}

.glossymenu div.submenu{ /*DIV that contains each sub menu*/
background: white;
}

.glossymenu div.submenu ul{ /*UL of each sub menu*/
list-style-type: none;
margin: 0;
padding: 0;
}

.glossymenu div.submenu ul li{
border-bottom: 1px solid #FFFF33;
}

.glossymenu div.submenu ul li a{
display: block;
font: normal 12px "Arial", "Trebuchet MS", Verdana, Helvetica, sans-serif;
color: #777777;
text-decoration: none;
padding: 2px 0;
padding-left: 10px;
}

.glossymenu div.submenu ul li a:hover{
background: #FFFF99;
color: orange;
}

</style>

--------------------------------------
In the body
--------------------------------------

<div class="glossymenu">
<a class="menuitem submenuheader" href="index.html">Introduction</a>
<div class="submenu">
<ul>
<li><a href="inclusions.html">Inclusions</a></li>
<li><a href="locations.html">Locations</a></li>
<li><a href="bookings.html">Bookings</a></li>
</ul>
</div>
<a class="menuitem submenuheader" href="legal.html" >Legal</a>
<div class="submenu">
<ul>
<li><a href="responsibilities.html">Responsibilities</a></li>
<li><a href="documents.html">Documents Required</a></li>
<li><a href="forms.html">Forms</a></li>
<li><a href="witnesses.html">Witnesses</a></li>
</ul>
</div>
<a class="menuitem submenuheader" href="ceremonies.html">Ceremonies</a>
<div class="submenu">
<ul>
<li><a href="music.html">Music</a></li>
<li><a href="family.html">Family</a></li>
<li><a href="rituals.html">Rituals & Customs</a></li>
</ul>
</div>
<a class="menuitem" href="nameday.html">Name Day</a>
<a class="menuitem" href="renewals.html">Renewals</a>
<a class="menuitem" href="commitment.html">Commitment Ceremonies</a>
<a class="menuitem" href="visitors.html">International Visitors</a>
<a class="menuitem" href="faqs.html">FAQ's</a>
<a class="menuitem" href="contact.html" style="border-bottom-width: 0">Contact Details</a>
</div>

3) Describe problem:

Hi,

I am very new to scripting so any help would be much appreciated...

My problem is that I can't seem to get any of the submenu header a href links working (menuitem submenuheader). When I click on any of the submenus ("menuitem") they work perfectly but the submenu headers don't.

Also is there a way so that when I click on each of the menu items the div remains highlighted on that html page?

I hope this makes sense :)

Thank you.

ddadmin
09-10-2008, 05:58 AM
Hmm it'll make things a lot easier if you can post a link to the problem page, so we can look at the issue live. Regarding:


Also is there a way so that when I click on each of the menu items the div remains highlighted on that html page?

Please do a search on the forums- this has been discussed quite a few times. In a nutshell, this is something that should be done on the server side.