I have a two column layout, where every block has a different height according to the content inside it. I wrote some jquery lines that take every pair of blocks, and apply the greater of both heights to both blocks, and it works fine, but I need it to resize on windows resize, and I'm stuck on how to do this.
I tried wrapping the function in a window.resize event but that didn't work at all. Once the page loads and the function runs one time, the heights don't change any more, so if I resize the window the content overflows.
The html code of the layout:
 <div class="catmenu cat61">
    <div class="row">
        <div class="col-md-6">
            <div class="row itemenu par">
              <p>content</p><p>content</p>
            </div>
            <hr class="hrp">
            <div class="row itemenu par">
               <p>content</p><p>content</p>
            </div>
        </div>
        <div class="col-md-6">
            <div class="row itemenu impar">
              <p>longer</p><p>content</p><p>longer</p><p>content</p>
            </div>
            <hr class="hrp">
            <div class="row itemenu impar">
               <p>longer</p><p>content</p><p>longer</p><p>content</p>
            </div>
        </div>
    </div>
</div>
 The jquery that does the trick on load:
 
var height1 = Math.max($( ".cat61 > div > div .row.itemenu.impar:nth-child(1)" ).height(), $( ".cat61 > div > div .row.itemenu.par:nth-child(1)" ).height());
 $(".cat61 > div > div .row.itemenu.impar:nth-child(1), .cat61 > div > div .row.itemenu.par:nth-child(1)").height(height1);
 I need the function to run on window.resize and update the heights according to the auto heights the blocks would render on resize, I'm guessing I need to somehow apply the auto height first and then run the jquery again but I don't know how to do this.
 
     
    