title: Jquery trying to change on scroll
body: <p>I'm trying to programming a site and hide nav bar if the user scroll but I do not know what's wrong with my code toggle works fine but not if I scroll</p>
  
  <p>Is there something bad with my code ?</p>
  
  <pre><code>&lt;script&gt;
  
     x = 0;   
    $(function() {
        $(".icon-menu").click(function(){
           $("nav").toggle();
        });
  
  
       $(".container").scroll(function(){
          $(".menu_txt").text( x+= 1);
          if (x &gt; 30) {
             $("nav").hide();
           }
        });
  
    });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I really appreciate a hand
  Thank you !</p>