Do the dynamically generated IDs follow a certain pattern, such as "x1", "x2".." etc? If so as far as initializing them, you can just do something like this in the HEAD section of your page:
Code:
for (var i=1; i<4; i++){
animatedcollapse.addDiv("x"+i, 'fade=0,speed=400,group=pets')
}
The above would be the same as if you had manually called:
Code:
animatedcollapse.addDiv("x1", 'fade=0,speed=400,group=pets')
animatedcollapse.addDiv("x2", 'fade=0,speed=400,group=pets')
animatedcollapse.addDiv("x3", 'fade=0,speed=400,group=pets')
Now, as far as also dynamically generating the corresponding links, such as:
Code:
<a href="javascript:animatedcollapse.toggle('x1')>
That's a little more tricky. There are a few different approaches I can think of, but more details on how much of your collapsible DIVs' markup is dynamically generated is needed first. For example, is everything generated this way, with the total number of DIVs involved unbeknownst by you until they are actually output?
Bookmarks