-3

I just get this code which makes all divs with equal_height_1 class to have the same height.

I just need to know if it can be improved and if it will work in all browsers. Thanks.

  $(window).load(function() {

   var highestBox = 0;

     $('.equal_height_1').each(function() {
            if($(this).height() > highestBox) 
         highestBox = $(this).height(); 
        }); 

        $('.equal_height_1').each(function() {
            $(this).height(highestBox);
     });

   });
chefnelone
  • 189
  • 1
  • 4
  • 16

1 Answers1

1

Try

 $('.equal_height_1').each(function() {
    if($(this).height() > highestBox) 
 highestBox = $(this).height(); 
  }); 

$('.equal_height_1').css("height",highestBox);
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53