The trick is to add and remove classes in Javascript ... And add a CSS3 transition as follows:
div { -webkit-transition: height .25s ease; -moz-transition: height .25s ease; transition: height .25s ease; }
A transition is applied, which you can control the speed of all your sections. Of course, you can choose which DOM elements to apply to yourself.
And then the two jquery functions that I used will be
$("#object").addClass("removeThis"); //hide $("#object").removeClass("removeThis"); //show
But as indicated, you cannot use jQuery! So here!
document.getElementById("object").className = ""; document.getElementById("object").className = "removeThis";
Where "#object" is the object you are aiming at and ".removeThis" is the class that you add and remove from the class attribute in the dom tag. This is how it looks in css.
#object { height: 200px; } .removeThis { height: 0; }
Assuming you want it to slide up and down. Another trick is to use opacity or display: none and display: block. But play. Hope this helps!
Edit since 2012: Since you are using JavaScript, you are asking for the work to be done in the main thread, you can use the composer stream, animating the transformation instead. That is, if you can understand how to get away from animating height style properties.
source share