title: jQuery and scroll requiring reload to work
body: <p>For some reason the class that's supposed to get added to my website when we start scrolling is not working until I hit &quot;refresh&quot; or do a right click &gt; inspect element.</p>
  <p>I'm guessing it has to do with my JavaScript code (bellow) but i'm unsure what's wrong.</p>
  <p>My test page is available here: <a href="http://192.46.223.146/publications/" rel="nofollow noreferrer">http://192.46.223.146/publications/</a></p>
  <pre><code>jQuery(document).ready(function($) {
  
      /* window */
      var window_width, window_height, scroll_top;
  
      /* admin bar */
      var adminbar = $('#wpadminbar');
      var adminbar_height = 0;
  
      /* header menu */
      var header = $('#g-header');
      var header_top = 0;
  
      /* scroll status */
      var scroll_status = '';
  
      /**
       * window load event.
       */
      $(window).on('load', function() {
          /** current scroll */
          scroll_top = $(window).scrollTop();
  
          /** current window width */
          window_width = $(window).width();
  
          /** current window height */
          window_height = $(window).height();
  
          /* get admin bar height */
          adminbar_height = adminbar.length &gt; 0 ? adminbar.outerHeight(true) : 0 ;
  
          /* get top header menu */
          header_top = header.length &gt; 0 ? header.offset().top - adminbar_height : 0 ;
  
          /* check sticky menu. */
          sticky_menu();
      
      });
  
      /**
       * resize event.
       */
      $(window).on('resize', function(event, ui) {
          /** current window width */
          window_width = $(event.target).width();
  
          /** current window height */
          window_height = $(window).height();
  
          /** current scroll */
          scroll_top = $(window).scrollTop();
  
          /* check sticky menu. */
          sticky_menu();
  
      });
  
      /**
       * scroll event.
       */
      $(window).on('scroll', function() {
          /** current scroll */
          scroll_top = $(window).scrollTop();
  
          /* check sticky menu. */
          sticky_menu();
  
      });
  
      /**
       * Sticky menu
       */
      function sticky_menu() {
          if ( $('#g-header-inner').hasClass('no-header-top') &amp;&amp; scroll_top &gt; 0 &amp;&amp; window_width &gt; 991) {
              header.addClass('header-fixed');
  
          } else {
              header.removeClass('header-fixed');
          }
      }
  }   
  </code></pre>