Skip to content
Permalink
Browse files

fix: only call onDone if it's defined

  • Loading branch information...
rigor789 committed Sep 10, 2019
1 parent 0c0a297 commit 55afb5075d6df07404d2ee6d8353ac49884c7372
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/scrollTo.js
@@ -162,8 +162,8 @@ export const scroller = () => {
x = options.x === undefined ? defaults.x : options.x;
y = options.y === undefined ? defaults.y : options.y;

var cumulativeOffsetContainer = _.cumulativeOffset(container);
var cumulativeOffsetElement = _.cumulativeOffset(element);
let cumulativeOffsetContainer = _.cumulativeOffset(container);
let cumulativeOffsetElement = _.cumulativeOffset(element);

if (typeof offset === "function") {
offset = offset(element, container);
@@ -212,7 +212,7 @@ export const scroller = () => {
if (onStart) onStart(element);

if (!diffY && !diffX) {
onDone(element);
if (onDone) onDone(element);
return;
}

0 comments on commit 55afb50

Please sign in to comment.
You can’t perform that action at this time.