0

I have the below Javascript that makes divs equal height. It works fine on initial pageload and sets the heights. But on resize it doesn't seem to fire. Any ideas why?

Here is a fiddle https://jsfiddle.net/caffeinehigh/ohrjLs7m/

$(window).resize(function() {

  var highestBox = 0;

      $('.casestudy-container .text').each(function(){

              if($(this).outerHeight() > highestBox) {
              highestBox = $(this).outerHeight();

      }
  });

  $('.casestudy-container .text').outerHeight(highestBox);

}).resize();
caffeinehigh
  • 309
  • 1
  • 3
  • 11

1 Answers1

0

I think you have an extra resize. The following seemed to work for me:

$(window).resize(function() {
  var highestBox = 0;
      $('.casestudy-container .text').each(function(){
        if($(this).outerHeight() > highestBox) {
          highestBox = $(this).outerHeight();
      }
  });

  $('.casestudy-container .text').outerHeight(highestBox);
});

Fiddle here: https://jsfiddle.net/pvsb9kr8/1/

Joseph Cho
  • 4,033
  • 4
  • 26
  • 33