Smoothly Scroll To Any Point Within The Document – slimScroller.js

Category: Animation , Javascript | December 27, 2019
Views Total:259 views
Official Page:Go to website
Last Update:December 27, 2019


Smoothly Scroll To Any Point Within The Document – slimScroller.js


slimScroller.js is an ultra-light JavaScript smooth scroll library that smoothly scrolls the page to any point within the document.

The point can be a CSS selector, an HTML element, or a position in pixels.

How to use it:

1. Load the slimScroller.js library in the document.

  • slimScroller.min.js (~0.5 kb): only supports CSS selector
  • slimScroller.full.min.js(~1 kb): supports any point
<script src="dist/slimScroller.min.js"></script>
<script src="dist/slimScroller.full.min.js"></script>

2. Smoothly scrolls to a specific point within the document.

// CSS selector
// Scrolls down 200px
// HTML element

3. Auto update the URL hash after scrolling.

window.addEventListener('load', function (){
  return slimScroller.bind(false, function (position){
    console.log('The current position is '+position);

You Might Be Interested In:

Leave a Reply