1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-22 12:53:23 +02:00

Fixing scrollable container in run time

This commit is contained in:
Antonio Laguna
2017-07-29 13:20:03 +02:00
parent 71121169f0
commit 7bcafd9f7c

View File

@@ -1,6 +1,6 @@
import Easings from './easing';
const SCROLLABLE_CONTAINER = document.getElementById('webslides');
let SCROLLABLE_CONTAINER = document.getElementById('webslides');
/**
* Smoothly scrolls to a given Y position using Easing.Swing. It'll run a
@@ -10,6 +10,8 @@ const SCROLLABLE_CONTAINER = document.getElementById('webslides');
* @param {function} cb Callback function to call upon completion.
*/
export default function scrollTo(y, duration = 500, cb = () => {}) {
SCROLLABLE_CONTAINER = SCROLLABLE_CONTAINER
|| document.getElementById('webslides');
const delta = y - SCROLLABLE_CONTAINER.scrollTop;
const startLocation = SCROLLABLE_CONTAINER.scrollTop;
const increment = 16;