Smooth Scroll To Animation with Anchor Scrolling JS Library

Category: Animation , Javascript | July 13, 2016
Author: bendc
Views Total: 6,370
Official Page: Go to website
Last Update: July 13, 2016
License: MIT

Preview:

Smooth Scroll To Animation with Anchor Scrolling JS Library

Description:

Anchor Scrolling is a small Javascript library to create anchor links which scroll the webpage to target section smoothly.

How to use it:

Include the Anchor Scrolling JS Library in your web page.

<script src="scroll.js"></script>

Create target sections.

<section id="section-1">
  ...
</section>

<section id="section-2">
  ...
</section>

<section id="section-3">
  ...
</section>

Create anchor tags pointing to the corresponding IDs.

<a href="#section-1">Section 1</a>
<a href="#section-2">Section 2</a>
<a href="#section-3">Section 3</a>

Changelog:

07/13/2016

  • Exception when there is no “a.scroll” element

You Might Be Interested In:


3 thoughts on “Smooth Scroll To Animation with Anchor Scrolling JS Library

  1. disqus_ZVT3YJaEph

    Great post but in “how to use it” is missing in anchor tag: class=”scroll”
    otherwise it will not work… And if you need use this for area tag (my case) so change in scroll.js line 4:
    var links = document.querySelectorAll(“a.scroll”)
    to
    var links = document.querySelectorAll(“area.scroll”)

    Reply

Leave a Reply