Copy this code and paste it in your HTML
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script> <div class=animated style="width:200px; height:200px; background-color:#ff00ff; display:block;"></div> $("#go").click(function() {
$(".animated").animate({width:'100px'}, {duration:2000, complete: function(){
$(".animated").animate({width:'200px'});
}});
}
);