Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with collapsible DIVs

Status
Not open for further replies.

d0nny

IS-IT--Management
Dec 18, 2005
278
GB
Hi

I have implemented some collapsible DIVs on an FAQ I am developing and I need some help with the change of state.

Here's the page code for collapsing the questions:
Code:
<strong><a href="javascript:animatedcollapse.toggle('Q1')">1. Do we need blah blah blah?</a></strong><br />
<div id="Q1"><p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah</p></div>

Here's the code I got from Dynamic Drive for collapsing:
Code:
<script type="text/javascript">
animatedcollapse.addDiv('Q1', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q2', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q3', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q4', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q5', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q6', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q7', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q8', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q9', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q10', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q11', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q12', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q13', 'fade=0,speed=600,group=faq,hide=1')
animatedcollapse.addDiv('Q14', 'fade=0,speed=600,group=faq,hide=1')

animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
	//$: Access to jQuery
	//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
	//state: "block" or "none", depending on state
}
animatedcollapse.init()
</script>
Obviously I have 14 questions. They are 'grouped' so that when you click on one question it collapses the other questions (you only have one question open at once).

There is obviously another JS file I reference but my question relates to changing the state of the font of the question once it is open.
So when someone clicks on the question, the DIV expands but I then want to change the question font size to enlarge it.

Is this possible with the information I have provided above, or is this done from within the JS file?

Thanks in advance...
 
Give your question links an ID each. Then you can use JS to alter their font either in your same function that toggles the divs, or in a different function you can set in there onClick events.

For further JS questions ask in: forum216


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks.
Wasn't sure if it was a JS question or a CSS question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top