View Full Version : collpase expand using just one button

04-12-2009, 10:51 PM
1) Script Title: Switch Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

3) Describe problem: no problem. would like to have the collapse/expand rendered into just one button please

hi im looking at the code. i get lost when trying to figure out how or when to set the user's first action, so every time they click the col/exp button the function executes accordingly (if var==expanded, then collapse) you get the idea

would really appretiate if yet, another tweak i ask would be complied :D

04-13-2009, 09:07 AM
Well, by default clicking on each of the headers will either collapse or expand its corresponding content depending on the later's state already. Are you talking about the ability to toggle a header using some arbitrary link on the page?

04-13-2009, 05:48 PM
no, im talking about only having one button to toggle the contract/expand of all divs. just like the default for each header, but applied to the contract all / expand all buttons. so instead of two buttons to toggle expand/contract on all divs, just one

04-14-2009, 03:21 AM
Sure, try the below modified .js file, which lets you add a link such as the below to toggle the states of all the contents similar to Collapse All and Contract All:

<a href="javascript:bobexample.sweepToggle('toggle')">Toggle All</a>