adding css to make divs equal
I have this ecommerce store and it displays each product in a box with equal heights using jQuery. I tried to apply the same code to another display of products and cannot get it to set the height on the divs. It is supposed to append the style min-height to the divs. I examined it in firebug. Do you see anything below that may be written a better way?
- var make_equal_height = function (element) {
var $within = jQuery(element),
selector = $within.attr('data-equal-height'),
$children = jQuery(selector, $within),
tallest = 0;
$children.each( function() {
var $this = jQuery(this);
$this.css('min-height', '');
var h = $this.height();
if ( h > tallest ) {
tallest = h;
}
});
$children.each( function() {
jQuery(this).css('min-height', tallest + 'px');
});
};