diff --git a/README.md b/README.md index b6fd0500e7dad8d4fb0cd0a79ed8246ca3f82770..a527bfc69ba583df7b6afe6adb9f53cb4a1ce694 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ yarn add @grifart/smoothscroll import SmoothScroll from '@grifart/smoothscroll'; SmoothScroll({ - load: true, - interaction: true, + scrollOnLoad: true, + scrollOnLinkClick: true, }); ``` @@ -27,8 +27,8 @@ SmoothScroll({ | Option | Value | Default value | Description | | --- | --- | --- | --- | -| `load` | `true`/`false` | `true` | Causes smooth scroll to anchored element when the page is loaded.\* -| `interaction` | `true`/`false` | `true` | Causes smooth scroll on given element when user clicks on an `a` tag having `href` starting with `#` character. +| `scrollOnLoad` | `true`/`false` | `true` | Causes smooth scroll to anchored element when the page is loaded.\* +| `scrollOnLinkClick` | `true`/`false` | `true` | Causes smooth scroll on given element when user clicks on an `a` tag having `href` starting with `#` character. \*Note: when the page load lasts more than 500 ms, load smooth scrolling is disabled as it would lead to user-unfriendly behaviour like jumping on the page up and down. diff --git a/demo.html b/demo.html index d24f8d8458f6bb10e68a8eb2987a2c9cdf3d0ab5..c18f2c4730b53d2106ed7a1f4be7f9a2e3fefd9f 100644 --- a/demo.html +++ b/demo.html @@ -8,8 +8,8 @@ <script src="dist/index.js" type="text/javascript"></script> <script> SmoothScroll({ - load: true, - interaction: true, + scrollOnLoad: true, + scrollOnLinkClick: true, }); </script> <style type="text/css"> diff --git a/src/index.ts b/src/index.ts index 43deb6fd9b8432f3d6de8db02fe3a4700957abcd..9f776a5e66d9fcff134d01625efecb55e14bdadd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,19 +4,19 @@ import {initializeOnLoadScroll} from './initializeOnLoadScroll'; import {initializeOnLinkClickScroll} from './initializeOnLinkClickScroll'; export interface SmoothScrollOptions { - readonly load?: boolean; - readonly interaction?: boolean; + readonly scrollOnLoad?: boolean; + readonly scrollOnLinkClick?: boolean; } function SmoothScroll(options?: SmoothScrollOptions): void { setupVelocity(Velocity); - if ( ! (options && options.load === false)) { + if ( ! (options && options.scrollOnLoad === false)) { initializeOnLoadScroll(); } - if ( ! (options && options.interaction === false)) { + if ( ! (options && options.scrollOnLinkClick === false)) { initializeOnLinkClickScroll(); } }