Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with Jquery code to vertically aligning DIV
    primarykey
    data
    text
    <p>I have everything set up on a jsFiddle page, please take a look at it here: <a href="http://jsfiddle.net/ryanjay/bq5eE/" rel="nofollow">http://jsfiddle.net/ryanjay/bq5eE/</a></p> <p>My problem is, when you open the DIV (column), it aligns all the other closed divs to the bottom of it. Can someone help me by adding some jquery code to make it so when you open each DIV(column) the other divs stay aligned to the top. Perhaps it has something to do with margin-top, I am unsure. </p> <p>I am also using a slider that wraps around the columns, so floating them isn't an option.. they just wrap to the next line. They must have a display of inline-block.</p> <p>Thanks</p> <p>Here is my HTML:</p> <pre><code>&lt;div class="column"&gt; &lt;div class="open"&gt; open &lt;/div&gt; &lt;div class="close"&gt;close&lt;/div&gt; &lt;div class="contentInner"&gt; &lt;div class="ProjectContainer"&gt; Content goes here. &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div class="open"&gt; open &lt;/div&gt; &lt;div class="close"&gt;close&lt;/div&gt; &lt;div class="contentInner"&gt; &lt;div class="ProjectContainer"&gt; Content goes here. &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is my Jquery: </p> <pre><code>$(document).ready(function() { //Page Load $('.column').css({ width: '200px', height: '200px' }); // Open $('.open').click(function() { $(this).parent().animate({ width: '400px', height: '520px', }, 500); $(this).hide(); $(this).siblings('.close').show(); $(this).siblings('.contentInner').fadeIn('slow', function() { $(this).show(); }); }); // Close $('.close').click(function() { $(this).parent().animate({ width: '200px', height: '200px' }, 500); $(this).siblings('.contentInner').fadeOut('100', function() { $(this).hide(); }); $(this).hide(); $(this).siblings('.open').fadeIn('150', function() { $(this).show(); }); }); }); </code></pre> <p>And my CSS:</p> <pre><code>.column { position: relative; width: 200px; border-left: 1px solid #999; border-right: 1px solid #999; height: 520px; margin: 30px 30px 0px 0px; display: inline-block; text-align: left; } .open { position: absolute; margin: 0px 0px 0px 0px; cursor: pointer; } .close { position: absolute; margin: 0px 0px 0px 368px; cursor: pointer; display: none; } .contentInner { position: absolute; width: 380px; height: 400px; font: 12px Helvetica, Arial, Sans-Serif; font-weight: 200; margin: 20px 0px 0px 10px; display: none; white-space: normal; } </code></pre> <p>You can always see it on jsFiddle here: <a href="http://jsfiddle.net/ryanjay/bq5eE/" rel="nofollow">http://jsfiddle.net/ryanjay/bq5eE/</a></p> <p>Thanks! </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.
 

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