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 infinite looping bug #469

Open
wants to merge 1 commit 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/locomotive-scroll.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! locomotive-scroll v4.1.3 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
/*! locomotive-scroll v4.1.4 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
html.has-scroll-smooth {
overflow: hidden; }

Expand Down
8 changes: 4 additions & 4 deletions dist/locomotive-scroll.esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* locomotive-scroll v4.1.3 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
/* locomotive-scroll v4.1.4 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
Expand Down Expand Up @@ -1277,7 +1277,7 @@ var _default$1 = /*#__PURE__*/function (_Core) {
*
* @param Available options :
* target {node, string, "top", "bottom", int} - The DOM element we want to scroll to
* options {object} - Options object for additionnal settings.
* options {object} - Options object for additional settings.
* @return {void}
*/

Expand Down Expand Up @@ -2279,7 +2279,7 @@ var _default$2 = /*#__PURE__*/function (_Core) {

this.updateScroll();
var distance = Math.abs(this.instance.delta[this.directionAxis] - this.instance.scroll[this.directionAxis]);
var timeSinceStart = Date.now() - this.startScrollTs; // Get the time since the scroll was started: the scroll can be stopped again only past 100ms
var timeSinceStart = Date.now() - this.startScrollTs ? this.startScrollTs : Date.now(); // Get the time since the scroll was started: the scroll can be stopped again only past 100ms

if (!this.animatingScroll && timeSinceStart > 100 && (distance < 0.5 && this.instance.delta[this.directionAxis] != 0 || distance < 0.5 && this.instance.delta[this.directionAxis] == 0)) {
this.stopScrolling();
Expand Down Expand Up @@ -2862,7 +2862,7 @@ var _default$2 = /*#__PURE__*/function (_Core) {
*
* @param Available options :
* target {node, string, "top", "bottom", int} - The DOM element we want to scroll to
* options {object} - Options object for additionnal settings.
* options {object} - Options object for additional settings.
* @return {void}
*/

Expand Down
8 changes: 4 additions & 4 deletions dist/locomotive-scroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* locomotive-scroll v4.1.3 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
/* locomotive-scroll v4.1.4 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -1283,7 +1283,7 @@
*
* @param Available options :
* target {node, string, "top", "bottom", int} - The DOM element we want to scroll to
* options {object} - Options object for additionnal settings.
* options {object} - Options object for additional settings.
* @return {void}
*/

Expand Down Expand Up @@ -2285,7 +2285,7 @@

this.updateScroll();
var distance = Math.abs(this.instance.delta[this.directionAxis] - this.instance.scroll[this.directionAxis]);
var timeSinceStart = Date.now() - this.startScrollTs; // Get the time since the scroll was started: the scroll can be stopped again only past 100ms
var timeSinceStart = Date.now() - this.startScrollTs ? this.startScrollTs : Date.now(); // Get the time since the scroll was started: the scroll can be stopped again only past 100ms

if (!this.animatingScroll && timeSinceStart > 100 && (distance < 0.5 && this.instance.delta[this.directionAxis] != 0 || distance < 0.5 && this.instance.delta[this.directionAxis] == 0)) {
this.stopScrolling();
Expand Down Expand Up @@ -2868,7 +2868,7 @@
*
* @param Available options :
* target {node, string, "top", "bottom", int} - The DOM element we want to scroll to
* options {object} - Options object for additionnal settings.
* options {object} - Options object for additional settings.
* @return {void}
*/

Expand Down
2 changes: 1 addition & 1 deletion dist/locomotive-scroll.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/locomotive-scroll.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/scripts/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/styles/main.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/scripts/Smooth.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default class extends Core {
const distance = Math.abs(
this.instance.delta[this.directionAxis] - this.instance.scroll[this.directionAxis]
);
const timeSinceStart = Date.now() - this.startScrollTs; // Get the time since the scroll was started: the scroll can be stopped again only past 100ms
const timeSinceStart = Date.now() - this.startScrollTs ? this.startScrollTs : Date.now(); // Get the time since the scroll was started: the scroll can be stopped again only past 100ms
if (
!this.animatingScroll &&
timeSinceStart > 100 &&
Expand Down