Optimized listener events
This commit is contained in:
parent
210eca6fa1
commit
5936575888
2 changed files with 10 additions and 8 deletions
|
|
@ -3,12 +3,12 @@ const configs = (function () {
|
|||
|
||||
// settings
|
||||
const enableLimit = true; // true or false
|
||||
const limit = 10; // integer
|
||||
const limit = 5; // integer
|
||||
|
||||
// animation
|
||||
const scrollSpeed = 30; // milliseconds (DO NOT PUT BELOW 5, COMPUTER MIGHT CRASH) the lower the value, the faster the scroll
|
||||
const scrollSpeed = 30; // milliseconds
|
||||
const pauseBetweenScrolls = 2000; // milliseconds
|
||||
const gapBetweenScrolls = "100px"; // px
|
||||
const gapBetweenScrolls = "50px"; // px
|
||||
|
||||
// STYLES
|
||||
// task list
|
||||
|
|
|
|||
|
|
@ -857,7 +857,12 @@ async function checkToAnimate() {
|
|||
document.querySelector(".secondary").style.display = "none";
|
||||
|
||||
// cancel animations
|
||||
cancelAnimation();
|
||||
if (primaryAnimation) {
|
||||
primaryAnimation.cancel();
|
||||
}
|
||||
if (secondaryAnimation) {
|
||||
secondaryAnimation.cancel();
|
||||
}
|
||||
scrolling = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -867,10 +872,6 @@ function addAnimationListeners() {
|
|||
primaryAnimation.addEventListener("finish", animationFinished);
|
||||
primaryAnimation.addEventListener("cancel", animationFinished);
|
||||
}
|
||||
if (secondaryAnimation) {
|
||||
secondaryAnimation.addEventListener("finish", animationFinished);
|
||||
secondaryAnimation.addEventListener("cancel", animationFinished);
|
||||
}
|
||||
}
|
||||
|
||||
function animationFinished() {
|
||||
|
|
@ -887,6 +888,7 @@ function cancelAnimation() {
|
|||
secondaryAnimation.cancel();
|
||||
}
|
||||
scrolling = false;
|
||||
console.log("animation cancelled");
|
||||
}
|
||||
|
||||
(function () {
|
||||
|
|
|
|||
Loading…
Reference in a new issue