I've put on my website a box which gets longer in height when it is clicked, I did this using the following code:
<script type="text/javascript">
var x=100; /*original height*/
function expand() {
document.getElementById("move").style.height=x+'px'; /*Height from css.css in the div called "move"*/
if(x>300) { /*Desired height after expansion*/
clearTimeout(t);
return;
}
x++; /*desired height isnt yet reached, keep expanding*/
t=setTimeout('expand()',0); /*Speed of expansion*/
}
</script>
The following is in the body:
<body>
<div id="move" onclick="expand()"></div>
</body>
The expansion part works perfectly but when I try to put text in there, I want each line of text to appear as the box is stretching rather than everything appearing at the same time because right now it makes it seem like the text is misaligned compared to the box.
If someone can figure out a way to do this please include a few comments so I can understand it better.