I think I figured out my issue. Below is the code to combine the two different versions of the accordion menu so you have both rollover effects and changing icons on the headings.
Code:
<!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">
<head>
<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: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "submenu", //Shared CSS class name of contents group
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
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["suffix", "<img src='closed.gif' class='statusicon' />", "<img src='open.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"
})
</script>
<style type="text/css">
.arrowlistmenu{
width: 180px; /*width of accordion menu*/
}
.arrowlistmenu .menuheader{ /*CSS class for menu headers in general (expanding or not!)*/
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
text-decoration: none;
padding-left: 12px;
height: 2em;
line-height: 2em;
display: block;
color: #000000;
text-decoration: none;
text-align: left;
background-color: #CCCC99;
border-top-width: 1px;
border-bottom-width: 1px;
border-left-width: 3px;
border-top-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #CCCC99;
border-bottom-color: #CCCC99;
border-left-color: #CCCC99;
cursor: hand;
cursor: pointer;
}
.arrowlistmenu .openheader{ /*CSS class to apply to expandable header when it's expanded*/
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
display: block;
background-color: #dfdfbf;
border-top-width: 1px;
border-bottom-width: 1px;
border-left-width: 3px;
border-top-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #666666;
border-bottom-color: #666666;
border-left-color: #666666;
}
.arrowlistmenu a.menuheader{
position: relative; /*To help in the anchoring of the ".statusicon" icon image*/
}
.arrowlistmenu a.menuheader:visited, .arrowlistmenu a.menuheader:active{
color: #000000;
}
.arrowlistmenu a.menuheader .statusicon{ /*CSS for icon image that gets dynamically added to headers*/
position: absolute;
top: 5px;
right: 5px;
border: none;
}
.arrowlistmenu a.menuheader:hover{
background-color: #DFDFBF;
border-top-width: 1px;
border-bottom-width: 1px;
border-left-width: 3px;
border-top-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #666666;
border-bottom-color: #666666;
border-left-color: #666666;
}
.arrowlistmenu div.submenu{ /*DIV that contains each sub menu*/
background-color: #CCCC99;
}
.arrowlistmenu div.submenu ul{ /*UL of each sub menu*/
list-style-type: none;
margin: 0;
padding: 0;
}
.arrowlistmenu div.submenu ul li{
border-bottom-width: 1px;
border-bottom-style: dotted;
border-bottom-color: #000000;
}
.arrowlistmenu div.submenu ul li a{
display: block;
color: black;
text-decoration: none;
padding-left: 11px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
padding-top: 1px;
padding-right: 0;
padding-bottom: 1px;
}
.arrowlistmenu div.submenu ul li a:hover{
background: #DFDCCB;
color: black;
}
</style>
</head>
<body>
<div class="arrowlistmenu">
<a class="menuheader expandable" href="#">Item 1</a>
<div class="submenu">
<ul>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Item 4</a></li>
</ul>
</div>
<a class="menuheader expandable" href="#">Item 2</a>
<div class="submenu">
<ul>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Item 4</a></li>
</ul>
</div>
<h3 class="menuheader" style="cursor: default">FeedBack</h3>
<div>
Regular contents here. Header does not expand or contact.
</div>
</div>
</body>
</html>
Bookmarks