#237: fix scrollTo viewport element

This commit is contained in:
SleepWalker 2016-12-28 08:11:35 +02:00
parent b328f7ba92
commit c8c8f5eb6d
2 changed files with 8 additions and 2 deletions

View File

@ -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);
}
}());
});

View File

@ -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');