Skip to content

Commit 6ff03b2

Browse files
rchlrigor789
authored andcommitted
fix: onDone not being called with force: true (references #111) (#129)
Change applies in case there is no need to scroll.
1 parent e3cab59 commit 6ff03b2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/scrollTo.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,19 @@ export const scroller = () => {
202202
}
203203
}
204204

205+
if (onStart) onStart(element);
206+
207+
if (!diffY && !diffX) {
208+
onDone(element);
209+
return;
210+
}
211+
205212
if (typeof easing === "string") {
206213
easing = easings[easing] || easings["ease"];
207214
}
208215

209216
easingFn = BezierEasing.apply(BezierEasing, easing);
210217

211-
if (!diffY && !diffX) return;
212-
if (onStart) onStart(element);
213-
214218
_.on(container, abortEvents, abortFn, { passive: true });
215219

216220
window.requestAnimationFrame(step);

0 commit comments

Comments
 (0)