Skip to content

Instantly share code, notes, and snippets.

@ingowennemaring
Created April 18, 2013 16:02
Show Gist options
  • Save ingowennemaring/5413930 to your computer and use it in GitHub Desktop.
Save ingowennemaring/5413930 to your computer and use it in GitHub Desktop.
Equal height boxes with jQuery
article {
float: left;
width: 200px;
margin-left: 30px;
&:first-child {
margin-left: 0;
}
}
<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>
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