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:
@@ -1,6 +1,6 @@
|
|||||||
import Easings from './easing';
|
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
|
* 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.
|
* @param {function} cb Callback function to call upon completion.
|
||||||
*/
|
*/
|
||||||
export default function scrollTo(y, duration = 500, cb = () => {}) {
|
export default function scrollTo(y, duration = 500, cb = () => {}) {
|
||||||
|
SCROLLABLE_CONTAINER = SCROLLABLE_CONTAINER
|
||||||
|
|| document.getElementById('webslides');
|
||||||
const delta = y - SCROLLABLE_CONTAINER.scrollTop;
|
const delta = y - SCROLLABLE_CONTAINER.scrollTop;
|
||||||
const startLocation = SCROLLABLE_CONTAINER.scrollTop;
|
const startLocation = SCROLLABLE_CONTAINER.scrollTop;
|
||||||
const increment = 16;
|
const increment = 16;
|
||||||
|
Reference in New Issue
Block a user