ul
  - var k = 0;
  while k < 5
    li
      - k++;
      a.scrollto(href="#a" + k)
        |Block #{k}
.wrapper
  - var k = 0;
  while k < 5
    - k++;
    div(id="a" + k)
      h2
        |Block #{k}
      - var n = 0;
      while n < 40
        p
          |Line 
          = n++
View Compiled
$(document).ready(function() {
    $("a.scrollto").click(function() {
        var elementClick = $(this).attr("href")
        var destination = $(elementClick).offset().top;
        $("html:not(:animated),body:not(:animated)").stop().animate({
            scrollTop: destination
        }, 800);
        return false;
    });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js