Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've done something similar in the past. You don't really need any javascript or jquery.</p> <p>What you will need is to set relative position on every child (which you have done) and create inside every child another container with absolute position. Then just add some css code to change height of this container on hover and also to adjust z-index properly.</p> <p><strong>Update:</strong> I've updated your code posted before. Just used last-child css to move last child up instead of only increasing height. Result is same as using javascript, but personally i would avoid using JS when not needed.</p> <p>Here is updated <a href="http://jsfiddle.net/2bU5D/11/" rel="nofollow">jsFiddle</a> (Added transitions and border - looks nice :) )</p> <p>CSS:</p> <pre><code>.parent{ position:relative; float:left; width:100px; background-color:pink; margin-right:10px; } .child{ position:relative; height: 60px; margin-bottom:10px; } .child &gt; .content { position: absolute; width: 100%; height: 60px; background-color:cyan; z-index: 1; } .child:hover &gt; .content { background: red; height: 100px; z-index: 2; } .child:last-child:hover &gt; .content { height: 100px; bottom: 0px; } </code></pre> <p>HTML:</p> <pre><code>&lt;div class="parent"&gt; &lt;div class="child"&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="child"&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="child"&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="parent"&gt; &lt;div class="child"&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="child"&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="child"&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
    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. 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