Need help altering this Jquery code to fix vertical positioning of an element -


i have set on jsfiddle page, please take @ here: http://jsfiddle.net/ryanjay/bq5ee/

my problem is, when open div (column), aligns other closed divs bottom of it. can me adding jquery code make when open each div(column) other divs stay aligned top. perhaps has margin-top, unsure.

i using slider wraps around columns, floating them isn't option.. wrap next line. must have display of inline-block.

thanks

here html:

<div class="column">     <div class="open">         open     </div>     <div class="close">close</div>     <div class="contentinner">         <div class="projectcontainer">             content goes here.          </div>     </div> </div>  <div class="column">     <div class="open">         open     </div>     <div class="close">close</div>     <div class="contentinner">         <div class="projectcontainer">             content goes here.          </div>     </div> </div> 

here jquery:

$(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();         });     });  }); 

and css:

.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; } 

you can see on jsfiddle here: http://jsfiddle.net/ryanjay/bq5ee/

thanks!

http://jsfiddle.net/bq5ee/7/

just add vertical-align style .content css block:

vertical-align: top; 

alternately, if need jquery, this:

$(".content").css("vertical-align", "top"); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -