PDA

View Full Version : Collapsible DIV's question



FalcorTheDog
09-05-2007, 10:55 AM
1) Script Title: Animated Collapsible DIV

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

3) Describe problem: The div's on my site are changed dynamically after the page has loaded. The content of the divs to be expanded is changed using innerHTML commands after some user input. This results in divs with heights different than their original value on the page load. So when I try to expand the div (after its been modified), it only expands to show half of the content. Is there any way to "tell" the Animated Collapse script the new height of the div so that it expands it properly?

ddadmin
09-05-2007, 08:34 PM
See this thread: http://www.dynamicdrive.com/forums/showthread.php?t=24159

FalcorTheDog
09-05-2007, 09:29 PM
thanks for pointing me in the right direction!

i wanted something a little different... i didn't want the new div contents to be displayed right away, so i came up with a little "hack" that would look something like this if you modified the example on the link above:


function test(){
document.getElementById('dog').innerHTML='<p>d<p>d<p>d<p>d<p>d<p>d<p>d<p>d<p>d'
document.getElementById('dog').style.height="500px"
collapse1.contentheight=500
collapse1.timelength = 0
collapse1.slideup()
collapse1.timelength = 1000;
collapse1.slidedown()
return false
}

basically it slides up the new content as soon as it is displayed with a timelength of 0 (so it happens instantly), and then readjusts the timelength and slides in down again normally.

thanks again for the help!