Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The trick is with appending and removing classes in Javascript... And attaching a CSS3 transition like this:</p> <pre><code>div { -webkit-transition: height .25s ease; -moz-transition: height .25s ease; transition: height .25s ease; } </code></pre> <p>This applies a transition you can control the speed of to all your divs. Of course you can select which DOM elements to apply it to yourself. </p> <p>And then the two jquery functions I'd use are</p> <pre><code>$("#object").addClass("removeThis"); //hide $("#object").removeClass("removeThis"); //show </code></pre> <p>But as pointed out you may not use jQuery! So here!</p> <pre><code>document.getElementById("object").className = ""; document.getElementById("object").className = "removeThis"; </code></pre> <p>Where "#object" is the object you are targeting, and ".removeThis" is the class you are adding and removing from the class attribute in the dom tag. Heres what it looks like in css.</p> <pre><code>#object { height: 200px; /* ignoring other CSS */ } .removeThis { height: 0; } </code></pre> <p>Assuming that you want it to slide up and down. Another trick is to use opacity, or display: none and display: block. But play around. I hope this helps!</p> <p>Edit since 2012: Since you're using using JavaScript you're asking for work to be done on the main thread, you can utilize the compositor thread by animating on a transform instead. That is if you can figure out how to get away from animating the height style property.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload