title: Trying to hide logo on scroll and on windows size
body: <p>I am new to coding and are trying to get a function for my nav to hide the logo and become fixed at top, but can not make this code to work.</p>
  
  <pre><code>function rekotex() {
  
    //Do something under 767 px.
    if (window.matchMedia) { 
      if(window.matchMedia("all and (max-width: 767px)").matches) {
  
          // Hide logo.
          jQuery("#logo-in-menu").hide();
      }
  
   } else { // Over 768px.
  
      // See if page is scrolled, if so hide Logo.
      var height = jQuery(window).scrollTop();
  
      if(height &lt;= 1){
          jQuery("#logo-in-menu").show();
          jQuery(".header").css({"height":230});
      }
  
      else if(height &gt; 1) {
          jQuery("#logo-in-menu").hide();
          jQuery(".header").css({"height":130});
      }
  
  }
  
  var doit;
      window.onresize = function(){
          clearTimeout(doit);
          doit = setTimeout(rekotex, 100);
      };
  }
  </code></pre>