View Full Version : Problem with Tabs script and Collapsable DIV

08-15-2007, 02:04 PM

I'm trying to have a collapsable div work inside an ajax Tab Div.

Everything works fine if the expandable/collapsable div is inside the default div (the one in the main page). But only as long as you don't change tabs, and load a different page inside the div. If you do and you go back to the original page it stops working.

I think the problem is with the location of this code:

<script type="text/javascript">

//Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
var collapse2=new animatedcollapse("cat", 800, true)


But I couldn't find out how to solve it.

I've uploaded an example here:


Any help would be greatly appreciated.


08-16-2007, 06:40 AM
The problem is the way the default/ non Ajax Tab's content is saved- as a "snapshot", using the .innerHTML property. This means when you click on a Ajax Tab and back to the default Tab, the script merely outputs the saved HTML of the Tab Content, with JavaScript inside no longer working.

The regular non Ajax Tab Content script (http://dynamicdrive.com/dynamicindex17/tabcontent.htm) works differently, and merely collapses the previous Tab Content when showing the new. This should mean any dynamic content within it should continue to work afterwards.