Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm kind of sleepy(It's 2:30 AM here) so I leave the half done answer here to give you an idea (I did it in 30 minutes so I guess with 30 minutes more you can get something really nice)</p> <p><a href="http://jsfiddle.net/LuL2s/2/" rel="nofollow">http://jsfiddle.net/LuL2s/2/</a></p> <p>The trick comes by the block-holder which make the ease animation and making a difference between when they appear and disappear</p> <p>JS</p> <pre><code>$(document).ready(function() { var open = true; $(".block").click(function() { var $this = $(this); var count = 0; if (open) { $this.parent().siblings().children().slideToggle("slow", function(){ if (count++ == 2) { $this.parent().siblings().animate({width: 'toggle', height:'toggle'}); } }); } else { $this.parent().siblings().animate({width: 'toggle', height:'toggle'}, function(){ if (count++ == 2) { $this.parent().siblings().children().slideToggle("slow"); } }); } open = !open; }); }); </code></pre> <p>HTML</p> <pre><code>&lt;div class="block-holder"&gt; &lt;div class="block"&gt; &lt;h2&gt;I'm block 1&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="block-holder"&gt; &lt;div class="block"&gt; &lt;h2&gt;I'm block 2&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="block-holder"&gt; &lt;div class="block"&gt; &lt;h2&gt;I'm block 3&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="block-holder"&gt; &lt;div class="block"&gt; &lt;h2&gt;I'm block 4&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>.block { width: 100%; height: 100%; text-align: center; line-height: 100px; cursor: pointer; } .block-holder:nth-child(1) .block { background: green; } .block-holder:nth-child(2) .block { background: red; } .block-holder:nth-child(3) .block { background: orange; } .block-holder:nth-child(4) .block { background: pink; } .block-holder { width: 200px; height: 100px; float: left; margin: 20px; } </code></pre>
 

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