PDA

View Full Version : Animated Collapsible DIV v2.4 help closing DIVs



minicat
06-13-2012, 03:02 PM
1) Animated Collapsible DIV v2.4

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

3) Describe problem:

Script all working fine but….
I have six Divs on a page. It is all configured with image swapping on toggle but I cannot find a way to close any open Divs when a new Div is toggled to expand i.e. only one DIV open at any one time. Can close open Divs using a separate text command like

<a href="#" rel="collapse[jason, kelly]">Collapse Jason and Kelly DIVs</a>

but would like this to happen when toggling a new DIV to open.

It seems that it is not possible to “stack” commands in REL= so is there another solution, please?

Thanks
David

ddadmin
06-13-2012, 05:31 PM
You can "group" multiple collapsible DIVs so when one within the group is expanded, the rest is closed. See Example 4, 5, and 6 (http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm) on the script page for a illustration of this.

To do this, inside the initialization code, just give each collapsible DIV the same "group" name, for example:


animatedcollapse.addDiv('cat', 'fade=0,speed=400,group=pets')
animatedcollapse.addDiv('dog', 'fade=0,speed=400,group=pets,persist=1,hide=1')
animatedcollapse.addDiv('rabbit', 'fade=0,speed=400,group=pets,hide=1')

minicat
06-13-2012, 08:12 PM
Thanks for that, easy when you know how!

Missed the significance of groups, behavior absolutely what I wanted.

Great stuff,

David