PDA

View Full Version : group toggle display



mickey4545
09-30-2009, 10:57 AM
1) Script Title: Animated Collapsible DIV v2.4

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

3) Describe problem: Toggle a group

Hi,
I know you can show or hide multiple div with something like that:

<a href="javascript:animatedcollapse.hide(['div1', 'div2', 'div3',...])>

but


<a href="javascript:animatedcollapse.toggle(['div1', 'div2', 'div3',...])>
doesnt work.

How can you toggle display a group, or multiple divs ?
Thank you !!

ddadmin
09-30-2009, 04:02 PM
There's no prebuilt function to toggle multiple DIVs at once. You can, however, just create a custom loop yourself to do this, ie:


<script type="text/javascript">

function togglemultiple(divids){
if (typeof divids=="object"){
for (var i=0; i<divids.length; i++)
animatedcollapse.toggle(divids[i])
}
else
animatedcollapse.toggle(divids)

}

</script>

Then:


<a href="javascript:animatedcollapse.togglemultiple(['div1', 'div2', 'div3',...])>

mickey4545
10-02-2009, 03:06 PM
thank you but it doesn't work.
Firebug says animatedcollapse.togglemultiple is not a function :(

ddadmin
10-02-2009, 06:41 PM
Ah yes, the second code should be:


<a href="javascript:togglemultiple(['div1', 'div2', 'div3',...])>

mickey4545
10-03-2009, 10:09 AM
thank you for support :)