PDA

View Full Version : Ajax Animated Collapsible IE



davethomas
01-24-2011, 04:50 PM
1) Script Title: Animated Collapsible DIV v2.4

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

3) Describe problem: I am trying to dynaimcally load via ajax, links with divs and each time an additional link and div are added to the page them also have the animated collapse capability. In Firefox and Chrome I have no issues but in IE8 it all goes wrong and only the most recently added div is collapsible. When ajax reads a successfull return I add the responseText to the end of the target div's innerHTML, add the id of the div to the end of an array then loop through this array with

for(i=0;i<Items.length;i++){

animatedcollapse.addDiv(Items[i],'fade=1,speed=200,hide=1');

}

//then finally

animatedcollapse.ontoggle=function($, divobj, state){}
animatedcollapse.init();

I found an uninit() method and tried using that onload of a new div but that is also not working.

If I build out an array in JS var ar = newArray('1','2','3','4'); then add all 4 divs in one ajax call then loop
for(i=0;i<ar.length;i++){

animatedcollapse.addDiv(ar[i],'fade=1,speed=200,hide=1');

}

all 4 divs work fine, but if i try and add individual divs after the first call to
animatedcollapse.ontoggle=function($, divobj, state){};
//AND
animatedcollapse.init();

only the last one added works