Created
April 18, 2013 16:02
-
-
Save ingowennemaring/5413930 to your computer and use it in GitHub Desktop.
Equal height boxes with jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
article { | |
float: left; | |
width: 200px; | |
margin-left: 30px; | |
&:first-child { | |
margin-left: 0; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="teaser-list"> | |
<article> | |
<div> | |
<h3>Consetetur</h3> | |
<p>Einflüsse des britischen Stils treffen auf Designs der 60er und 70er Jahre. Color Blocking, kurze Kleider und Ponchos.</p> | |
</div> | |
</article> | |
<article> | |
<div> | |
<h3>Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet</h3> | |
<p>Modischer Strick-Poncho ab € 69,90</p> | |
</div> | |
</article> | |
<article> | |
<div> | |
<h3>Lorem ipsum</h3> | |
<p>Wir beraten Sie persönlich, lege online reservierte Artikel in der FiIiale zurück und nehme Ihre Online-Retouren an.</p> | |
</div> | |
</article> | |
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var equalBoxes = function(row, box) { | |
$(row).each(function() { | |
var $this = $(this), | |
max = 0; | |
$(box, $this).css('height', 'auto').each( | |
function() { | |
max = Math.max( $(this).height(), max ); | |
} | |
).height(max); | |
}); | |
}; | |
equalBoxes('.product-list', 'div'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment