title: Scroll to a section, with an offset
body: <p>I'm searching for a way to scroll to a section and add a distance to the scroll (220px), because there is a fixed menu.<a href="https://i.stack.imgur.com/YYW4j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YYW4j.png" alt="enter image description here"></a></p>
  
  <p>How could I set a scroll distance from the top of the window ?
  Here is the code I've made so far:</p>
  
  <pre><code>    $(document).ready(function() {
      $('.menudeux').on('click', function() { // Au clic sur un élément
          var page = $(this).attr('href'); // Page cible
          var speed = 750; // Durée de l'animation (en ms)
          var offset = 220;   
          $('html, body').animate( { scrollTop: $(page).offset().top}, speed ); // Go
          return false;
      });
  });
  
  
     &lt;nav class="nav-collapse"&gt;
      &lt;a class="menuone" href="#theme" data-scroll&gt;Thème&lt;/a&gt;
       &lt;a class="menuone" href="#prog" data-scroll &gt;Programmation&lt;/a&gt;
       &lt;a class="menuone" href="#intervenants" data-scroll&gt;Intervenants&lt;/a&gt;
       &lt;a class="menuone" href="#infos" data-scroll&gt;Infos&lt;/a&gt;
    &lt;/nav&gt;
  
  
    &lt;section id="theme"&gt;content&lt;/section&gt;
    &lt;section id="prog"&gt;content&lt;/section&gt;
    &lt;section id="intervenants"&gt;content&lt;/section&gt;
    &lt;section id="infos"&gt;content&lt;/section&gt;
  </code></pre>