Scroll to content
All samples are using
Ink.requireModules, please read how to use it at Ink.requireModules section
|.init([selector])||Has smooth scrolling applied to relevant elements upon page load.|
|.scroll(scrollTop, options)||Moves the scrollbar to the target element. This is the function|
|.changeHash||Change the URL hash (location.hash) when done scrolling? Defaults to true.|
|.margin||The default top margin.|
|.speed||The default scrolling speed. Higher is slower. Defaults to 10.|
Has smooth scrolling applied to relevant elements upon page load.
Listens to the click event on the document.
Anything which matches the selector will be considered a "link" by SmoothScroller and handled as such.
When a link is clicked, it is checked for several options:
data-margin="0"- A margin in pixels -- useful when you have a position:fixed top bar.
data-speed="10"- Inverse speed of the scrolling motion. Smaller is faster.
data-change-hash="true"- Change the URL hash (location.hash) when done scrolling.
selector'a.scrollableLink,a.ink-smooth-scroll'Selector string for finding links with smooth scrolling enabled.
[lots and lots of content...]
Moves the scrollbar to the target element. This is the function
which animates the scroll position bit by bit. It calls itself in
the end through requestAnimationFrame
scrollTopY coordinate value to stop at
optionsOption hash containing:
options.marginSet this to non-zero to leave a margin between the top of the page and your element. Useful if you have a top bar with `position: fixed`.
options.speedInverse scrolling speed. Smaller is faster.
Change the URL hash (location.hash) when done scrolling? Defaults to true.
The default top margin.
Use this when you want the scroll motion to stop before it reaches its destination, for example when you want to add some breathing space or have a position:fixed top bar in front of your content.
The default scrolling speed. Higher is slower. Defaults to 10.