title: Sleep function before smooth scroll
body: <p>How can I add a 3 seconds pause before the smooth scroll?
  The user will click on the button, then there will be a sleep of 3 seconds and then the smooth scroll will run.</p>
  
  <pre><code> $(function() {
    $('a[href*=#]:not([href=#])').click(function() {
      if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') &amp;&amp; location.hostname == this.hostname) {
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
        if (target.length) {
          $('html,body').animate({
            scrollTop: target.offset().top
          }, 1000);
          return false;
        }
      }
    });
  });
  </code></pre>