diff --git a/docs/new.html b/docs/new.html
index 2be12c2..d1e4879 100644
--- a/docs/new.html
+++ b/docs/new.html
@@ -71,7 +71,7 @@
panelSelector: '> section',
directionThreshold: 50,
delay: 0,
- slideSpeed: 200,
+ duration: 300,
easing: function(t) { return t },
};
@@ -90,7 +90,7 @@ Options explained
(interger) The amount of pixels required to scroll before the plugin detects a direction and snaps to the next panel.
delay
(integer) The amount of miliseconds the plugin pauzes before snapping to a panel.
- slideSpeed
+ duration
(integer) The amount of miliseconds in which the plugin snaps to the desired panel.
easing
(function) An easing function specificing the snapping motion.
diff --git a/src/panelSnap.js b/src/panelSnap.js
index 346b245..65f8108 100644
--- a/src/panelSnap.js
+++ b/src/panelSnap.js
@@ -17,7 +17,7 @@ const defaultOptions = {
panelSelector: '> section',
directionThreshold: 50,
delay: 0,
- slideSpeed: 200,
+ duration: 300,
easing: t => t,
};
@@ -176,12 +176,14 @@ export default class PanelSnap {
this.targetScrollOffset = getTargetScrollOffset(this.container, panel, toBottom, toRight);
- const start = 0;
- const end = TWEEN_MAX_VALUE;
- const duration = 300;
+ this.animation = new Tweezer({
+ start: 0,
+ end: TWEEN_MAX_VALUE,
+ duration: this.options.duration,
+ });
- this.animation = new Tweezer({ start, end, duration });
this.animation.on('tick', this.animationTick.bind(this));
+
this.animation.on('done', () => {
this.emit('snapStop', panel);
this.clearAnimation();