title: fix div on top after scroll down?
body: <p>i try to fix on the top: div with id "sticky" after scrolling, but doesnt work,ithink that the java script code is the problem.
  can someone help me to do it.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function sticky_relocate() {
    var window_top = $(window).scrollTop();
    var div_top = $('#sticky-anchor').offset().top;
    if (window_top &gt; div_top) {
      $('#sticky').addClass('stick');
      $('#sticky-anchor').height($('#sticky').outerHeight());
    } else {
      $('#sticky').removeClass('stick');
      $('#sticky-anchor').height(0);
    }
  }
      
  $(function() {
    $(window).scroll(sticky_relocate);
    sticky_relocate();
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#sticky {
    background-color: red;
    height:140px;
    z-index: 1;
  }
      
  #sticky.stick {
    position: fixed;
    top: 0;
    z-index: 1;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="sticky-anchor"&gt;&lt;/div&gt;
  &lt;div id="sticky"&gt;
    &lt;ul class="menu"&gt;
      &lt;li&gt;&lt;a href="#"&gt;Nos Produits&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt; &lt;!--  ul end .menu --&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>