From 9dfb12f6376c32076f63a7959cca365e94f81dad Mon Sep 17 00:00:00 2001 From: Daniel Kurowski <daniel.kurowski@grifart.cz> Date: Fri, 29 May 2020 16:00:37 +0200 Subject: [PATCH] BC break: changed API configuration option names --- README.md | 8 ++++---- demo.html | 4 ++-- src/index.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b6fd050..a527bfc 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 d24f8d8..c18f2c4 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 43deb6f..9f776a5 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(); } } -- GitLab