mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-23 13:23:23 +02:00
Merge branch 'master' into dev
# Conflicts: # src/js/utils/scroll-to.js
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "webslides",
|
"name": "webslides",
|
||||||
"version": "1.3.1",
|
"version": "1.3.3",
|
||||||
"description": "Making HTML presentations easy",
|
"description": "Making HTML presentations easy",
|
||||||
"main": "static/js/webslides.js",
|
"main": "static/js/webslides.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
import Easings from './easing';
|
import Easings from './easing';
|
||||||
|
|
||||||
|
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
|
||||||
* callback upon finishing.
|
* callback upon finishing.
|
||||||
@@ -8,11 +10,10 @@ import Easings from './easing';
|
|||||||
* @param {function} cb Callback function to call upon completion.
|
* @param {function} cb Callback function to call upon completion.
|
||||||
* @param {HTMLElement} container The HTML element where to scroll
|
* @param {HTMLElement} container The HTML element where to scroll
|
||||||
*/
|
*/
|
||||||
export default function scrollTo(y, duration = 500, cb = () => {},
|
export default function scrollTo(
|
||||||
container = null) {
|
y, duration = 500, cb = () => {}, container = null) {
|
||||||
const SCROLLABLE_CONTAINER = container
|
SCROLLABLE_CONTAINER = container ?
|
||||||
? container
|
container : document.getElementById('webslides');
|
||||||
: 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;
|
||||||
|
Reference in New Issue
Block a user