title: Change Div Position on Window Resize
body: <p>When I resize my browser window the following code isn't being activated. Only on page load the <strong>else if</strong> statement work. What am I doing wrong? </p>
  
  <pre><code>$(updateBoxDimension);
  $(document).ready(updateBoxDimension);
  $(window).on('resize', updateBoxDimension);
  
  function updateBoxDimension() {
      var $box = $('.case-study-outer');
  
      // To center the box
      var boxTop = ($(window).height()) / 2 - ($box.height() / 2);
  
      if ($(window).width() &lt; 900) {
          $box.css({
              top: inherit
          });
      } else if ($(window).width() &gt; 900) {
          $box.css({
              top: boxTop
          });
      }
  }
  </code></pre>