I rewrite it that it used CSS3 transition:
JS (for quick so you can change it to vanilla js):
$(function(){ $("#clicky").click(function(){ $("#main").addClass('animate'); }); });
CSS
#main{ width: 200px; height: 200px; background-color: #eee; border: 1px solid black; -webkit-transition: height 2s linear; } #main:after{ content: "look"; height: 50px; background-color: white; margin-left: 210px; border: 1px solid black; } #main.animate{ height: 500px; }
http://jsfiddle.net/qFhaq/1/
source share