In my code I use jQuery's toggle('slow')
animation to make a hidden div appear/disappear. It expands from the upper left to the bottom right.
How can I make it expand from the top towards the bottom, instead (no left-to-right growth)?
You could use .slideToggle('slow')
.
.toggle('slow')
. Doesn't work in my app though; still working it out.
.toggle('slow')
, check the manual.
Try .slideDown('slow')
. Note that this will only work for sliding down (to reveal) and sliding up (to hide). For anything more complex, you're looking for .animate(...)
or something from jQuery UI.
You could use jQuery's .animate
(http://api.jquery.com/animate/) instead. That way you can set the CSS properties before and after the expand and only alter the height.
Try to put an with onclick $('#DIV-ID').toggle('slow'); return false;
Just like this: <a onclick="$('#DIV-ID').toggle('slow'); return false;">DROP DOWN</a>