Skip to content
Snippets Groups Projects
Commit 9dfb12f6 authored by Daniel Kurowski's avatar Daniel Kurowski
Browse files

BC break: changed API configuration option names

parent b04e4a42
Branches
Tags
1 merge request!7Improve structure
......@@ -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.
......
......@@ -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">
......
......@@ -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();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment