diff --git a/README.md b/README.md index 3ba5408cb4ec1aa7842b91a36e2a493fea186efc..f22c531e38c1a00a8e36bb6fd6d29388f7d83226 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ is importable through standard ES `import` directive. |---|---| | **`handleOnLoadScroll()`** | Attaches scrolling to anchored element when the page is loaded.\* | | **`handleOnLinkClickScroll()`** | Attaches scrolling to given element when user clicks on an `a` tag having `href` starting with `#` character. | -| **`handleGlobalScrollingBehavior()`** | Calls all functions above. | Use these functions **in top-level code**: ```javascript -import {handleGlobalScrollingBehavior} from '@grifart/smoothscroll'; +import {handleOnLoadScroll, handleOnLinkClickScroll} from '@grifart/smoothscroll'; -handleGlobalScrollingBehavior(); +handleOnLoadScroll(); +handleOnLinkClickScroll(); ``` \*Note: when page load lasts more than 500 ms, load scroll effect diff --git a/dist/index.d.ts b/dist/index.d.ts index 37fb06b5efa2375cb575bf148fa0b803cc66c08d..f22f8f6df32e785046fdd87d959ef4c3a1c65a85 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -2,7 +2,6 @@ import { scrollToElement } from './scrollers/scrollToElement'; import { scrollToOffset } from './scrollers/scrollToOffset'; import { scrollToTarget } from './scrollers/scrollToTarget'; import { HashTarget } from './HashTarget'; -declare function handleGlobalScrollingBehavior(): void; declare function handleOnLoadScroll(): void; declare function handleOnLinkClickScroll(): void; -export { HashTarget, handleGlobalScrollingBehavior, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget, }; +export { HashTarget, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget, }; diff --git a/dist/index.esm.js b/dist/index.esm.js index 381d54b73a86f8864836db5751c98928e081a45b..0ec3668cb4d4a7dfe90bf3a2083c8dae63f78279 100644 --- a/dist/index.esm.js +++ b/dist/index.esm.js @@ -219,10 +219,6 @@ function scrollToOffset(topOffset, onScrollFinishedCallback) { } bindEasingToVelocity(Velocity); -function handleGlobalScrollingBehavior() { - handleOnLoadScroll(); - handleOnLinkClickScroll(); -} function handleOnLoadScroll() { initializeOnLoadScroll(); } @@ -230,4 +226,4 @@ function handleOnLinkClickScroll() { initializeOnLinkClickScroll(); } -export { HashTarget, handleGlobalScrollingBehavior, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget }; +export { HashTarget, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget }; diff --git a/dist/index.js b/dist/index.js index d3b9905ec2f30da69572f8fe43779a1fbb0e2047..43bc650a1a0211ff794c554189330dc1e835b4af 100644 --- a/dist/index.js +++ b/dist/index.js @@ -222,10 +222,6 @@ } bindEasingToVelocity(Velocity); - function handleGlobalScrollingBehavior() { - handleOnLoadScroll(); - handleOnLinkClickScroll(); - } function handleOnLoadScroll() { initializeOnLoadScroll(); } @@ -234,7 +230,6 @@ } exports.HashTarget = HashTarget; - exports.handleGlobalScrollingBehavior = handleGlobalScrollingBehavior; exports.handleOnLoadScroll = handleOnLoadScroll; exports.handleOnLinkClickScroll = handleOnLinkClickScroll; exports.scrollToElement = scrollToElement; diff --git a/src/esImportTest.ts b/src/esImportTest.ts index 73ca0196dc5bfb638d4d24b66b14328a2cfa8073..672ba18c036e12c2a5748aac1c6b64b168a426bb 100644 --- a/src/esImportTest.ts +++ b/src/esImportTest.ts @@ -1,6 +1,5 @@ // dummy test // if import statements do not scream this test passes -import {handleGlobalScrollingBehavior} from './index'; import {handleOnLoadScroll} from './index'; import {handleOnLinkClickScroll} from './index'; import {scrollToElement} from './index'; diff --git a/src/index.ts b/src/index.ts index 3eb37152f16be5323f8b30ec62467c26d5b9d5d3..2c0337517a877842ef2954f54c602ec4401cd99a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,12 +12,6 @@ import {HashTarget} from './HashTarget'; bindEasingToVelocity(Velocity); -function handleGlobalScrollingBehavior(): void -{ - handleOnLoadScroll(); - handleOnLinkClickScroll(); -} - function handleOnLoadScroll(): void { initializeOnLoadScroll(); @@ -30,7 +24,6 @@ function handleOnLinkClickScroll(): void export { HashTarget, - handleGlobalScrollingBehavior, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, diff --git a/src/integrationTest.html b/src/integrationTest.html index d74a879baa7611bc73f6ba3e71c99da1020a549d..9dbe03805a72d56fe18ac5e383aa1b16e7f28a3b 100644 --- a/src/integrationTest.html +++ b/src/integrationTest.html @@ -7,7 +7,8 @@ <script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5/velocity.min.js"></script> <script src="../dist/index.js" type="text/javascript"></script> <script> - SmoothScroll.handleGlobalScrollingBehavior(); + SmoothScroll.handleOnLoadScroll(); + SmoothScroll.handleOnLinkClickScroll(); document.addEventListener('DOMContentLoaded', () => { document.getElementById('scrollToElement').addEventListener('click', (event) => {