A pure Javascript library enabling smooth scrolling around a page.
The scrolling is even smoother by using window.requestAnimationFrame()
which syncs with the refresh rate of the monitor!
-
Include the library on your page:
<script src="/js/vendor/smooth-scroll/smooth-scroll.js"></script>
-
Add an ID to the target element to scroll to:
<section id="foo"> ... </section>
-
Add the
js_smoothScroll
class to the links you want to enable scrolling on, ensuring the href points to the ID defined<a href="#foo" class="js_smoothScroll">Link text</a>
-
Tada!
Tested and working in:
- IE9+
- Firefox >= 35.0
- Chrome >= 41.0.2272.118