Skip to content

Commit

Permalink
fix: only call onDone if it's defined
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 committed Sep 10, 2019
1 parent 0c0a297 commit 55afb50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scrollTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -212,7 +212,7 @@ export const scroller = () => {
if (onStart) onStart(element);

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

Expand Down

0 comments on commit 55afb50

Please sign in to comment.