Auto Apply Smooth Scroll Behavior To Anchor Links – anchor-scroll

Category: Animation , Javascript | December 31, 2019
Author: bendc
Views Total: 267
Official Page: Go to website
Last Update: December 31, 2019
License: MIT

Preview:

Auto Apply Smooth Scroll Behavior To Anchor Links – anchor-scroll

Description:

The anchor-scroll JavaScript library automatically applies a smooth scroll behavior on anchor links within the document.

Ideal for in-page navigation that enables the page to smoothly scrolls through content sections without page jumping.

How to use it:

1. Download and load the minified version of the anchor-scroll library.

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

2. Simply add the scroll class to the anchor links within the document and the library will do the rest.

<main id="top">
  <a class="scroll" href="#footer">Go To Footer</a>
</main>
<footer id="footer">
  <a class="scroll" href="#top">Go To Top</a>
</footer>

You Might Be Interested In:


Leave a Reply