1) Script Title: Accordion Content script (v1.3)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...daccordion.htm
3) Describe problem:
I am using this script to collapse and expand content for 40 questions and answers, and have a question re text color. With the header text in black, I have been able to get the header text to change color when the question is expanded to view the answer. Is it possible to have the header text remain the different color once someone has collapsed the question after viewing, so they will know they have already viewed the question, similar to a visited link? The coding follows.
This is a great script and just what I had been looking for to organize a lot of content. Thank you very much for any help you can provide.
<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>
<style type="text/css">
.question{ /*header of 1st demo*/
cursor: hand;
cursor: pointer;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
text-decoration:none;
}
.openquestion{ /*class added to contents of 1st demo when they are open*/
color: #336699;
}
.text10{ /*class added to contents of 1st demo when they are open*/
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
text-decoration:none;
}
</style>
<script type="text/javascript">
//Initialize first demo:
ddaccordion.init({
headerclass: "question", //Shared CSS class name of headers group
contentclass: "text10", //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: ["", "openquestion"], //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: "fast", //speed of animation: "fast", "normal", or "slow"
oninit:function(expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isclicked){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
</script>
Bookmarks