title: Update elements height when resize window
body: <p>I have a JS code:</p>
  
  <pre><code>var setPostHeaderHeightsInSlider = function() {
      var titlesHeight = 0;
      var teasersHeight = 0;
  
      $('.posts-slider .post-item').each(function() {
          var titleHeight = $(this).find('.post .post-header h3').height();
          var teaserHeight = $(this).find('.post .post-header p').height();
  
          if (titleHeight &gt; titlesHeight) {
              titlesHeight = titleHeight;
              $('.posts-slider .post-item .post .post-header h3').css('height', titlesHeight);
          }
  
          if (teaserHeight &gt; teasersHeight) {
              teasersHeight = teaserHeight;
              $('.posts-slider .post-item .post .post-header p').css('height', teasersHeight);
          }
      });
  };
  
  var onResize = function() {
      console.log('resize');
      setPostHeaderHeightsInSlider();
  };
  
  $(document).ready(function () {
      onResize();
      $(window).on('resize', function(){
          onResize();
      });
  }
  </code></pre>
  
  <p>I need update heights of elements when window resize but my code doesn't work.</p>
  
  <p>I see text in console but heights doesn't update.</p>
  
  <p>@edit:</p>
  
  <p>I put my html code.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="posts-slider swiper-container w-100 fl"&gt;
      &lt;div class="swiper-wrapper"&gt;
          &lt;div class="post-item swiper-slide ph4 pt3"&gt;
              &lt;a href="artykul.html" class="w-100 fl"&gt;
                  &lt;article class="post w-100 fl"&gt;
                      &lt;figure class="post-photo w-100 tc fl ma0 relative"&gt;
                          &lt;img src="img/post_01.jpg" alt="Post 01" class="dib mw-100"&gt;
                      &lt;/figure&gt;
                      &lt;header class="post-header w-100 tl fl"&gt;
                          &lt;h3 class="ma0 mt3"&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit&lt;/h3&gt;
                          &lt;p class="ma0 mt3"&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis, itaque, sapiente! Aliquid autem, deserunt dicta dolorum earum eius explicabo incidunt, modi natus temporibus ullam ut vel voluptatum? Libero recusandae, unde?&lt;/p&gt;
                       &lt;/header&gt;
                       &lt;footer class="post-footer w-100 tl fl"&gt;
                            &lt;p class="pv3 ma0 mt4"&gt;22 czerwca 2017&lt;/p&gt;
                       &lt;/footer&gt;
                 &lt;/article&gt;
            &lt;/a&gt;
        &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>Height is set only when the page is refreshed.</p>