If you change the DIV content that's being animated on the fly, not only should you change the height of the DIV accordingly, but also the contentheight property for that animated instance. The later is what the script refers to to tell how tall the DIV is. With that in mind, here's a little demo:
Code:
<a href="javascript:collapse1.slidedown()">Slide Down</a> || <a href="javascript:collapse1.slideup()">Slide Up</a>
<div id="dog" style="width: 300px; height: 110px; background-color: #99E0FB;">
<!--Your DIV content as follows -->
<h3>Content inside DIV!</h3>
<h4>Note: CSS height attribute defined</h4>
</div>
<script type="text/javascript">
//Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
var collapse1=new animatedcollapse("dog", 1000, false)
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
return false
}
</script>
<a href="#" onClick="test()">Change content</a>
Note the 2 lines in red.
Bookmarks