Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix scrollTo infinite loop #30

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion dist/dom7.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Licensed under MIT
*
* Released on: May 15, 2020
* Released on: June 23, 2020
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
Expand Down Expand Up @@ -1253,6 +1253,10 @@
var startTime = null;
if (animateTop && newTop === currentTop) { animateTop = false; }
if (animateLeft && newLeft === currentLeft) { animateLeft = false; }
if (!animateLeft && !animateTop) {
if (callback) { callback(); }
return;
}
function render(time) {
if ( time === void 0 ) time = new Date().getTime();

Expand Down
4 changes: 2 additions & 2 deletions dist/dom7.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dom7.min.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/dom7.modular.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Licensed under MIT
*
* Released on: May 15, 2020
* Released on: June 23, 2020
*/
import { document, window } from 'ssr-window';

Expand Down Expand Up @@ -1014,6 +1014,10 @@ function scrollTo(...args) {
let startTime = null;
if (animateTop && newTop === currentTop) animateTop = false;
if (animateLeft && newLeft === currentLeft) animateLeft = false;
if (!animateLeft && !animateTop) {
if (callback) callback();
return;
}
function render(time = new Date().getTime()) {
if (startTime === null) {
startTime = time;
Expand Down
6 changes: 5 additions & 1 deletion dist/dom7.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Licensed under MIT
*
* Released on: May 15, 2020
* Released on: June 23, 2020
*/
import { document, window } from 'ssr-window';

Expand Down Expand Up @@ -1076,6 +1076,10 @@ function scrollTo(...args) {
let startTime = null;
if (animateTop && newTop === currentTop) animateTop = false;
if (animateLeft && newLeft === currentLeft) animateLeft = false;
if (!animateLeft && !animateTop) {
if (callback) callback();
return;
}
function render(time = new Date().getTime()) {
if (startTime === null) {
startTime = time;
Expand Down
4 changes: 4 additions & 0 deletions src/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ function scrollTo(...args) {
let startTime = null;
if (animateTop && newTop === currentTop) animateTop = false;
if (animateLeft && newLeft === currentLeft) animateLeft = false;
if (!animateLeft && !animateTop) {
if (callback) callback();
return;
}
function render(time = new Date().getTime()) {
if (startTime === null) {
startTime = time;
Expand Down