diff --git a/src/components/ui/scrollTo.js b/src/components/ui/scrollTo.js index 5f6d809..ab84eb7 100644 --- a/src/components/ui/scrollTo.js +++ b/src/components/ui/scrollTo.js @@ -31,7 +31,13 @@ export default function scrollTo(y, viewPort) { return; } - viewPort.scrollTop = y + delta; + const newScrollTop = y + delta; + viewPort.scrollTop = newScrollTop; + + if (viewPort.scrollTop === 0) { + scrollWasTouched = true; + console.warn('The viewPort is not scrollable', viewPort); + } }()); }); diff --git a/src/index.js b/src/index.js index 9b2232e..b5059eb 100644 --- a/src/index.js +++ b/src/index.js @@ -73,7 +73,7 @@ function restoreScroll() { setTimeout(() => { const id = hash.replace('#', ''); const el = id ? document.getElementById(id) : null; - const viewPort = document.getElementById('view-port'); + const viewPort = document.body; if (!viewPort) { console.log('Can not find viewPort element');