Friday, July 22, 2011

jquery to find out max height of <li> (column)

var max = -1;
$(".ulClassName li").each(function() {
var h = $(this).height();
max = h > max ? h : max;
       
$(this).css({'min-height': max});
});
alert(max);

1 comment:

  1. or

    var max = Math.max.apply(this,
    $(".ulClassName li").map(
    function() { return $(this).attr('height') }
    ));

    ReplyDelete