Author: | bendc |
---|---|
Views Total: | 11,059 views |
Official Page: | Go to website |
Last Update: | July 13, 2016 |
License: | MIT |
Preview:

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
Thanks!!!
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”)
Arrow javascript function aren’t support by several browser (the most importan on desktop, Safari):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
The script is amazing anyway. are there someone that has find a way to conversion in norma javascript script?