mirror of
https://github.com/GuerillaStudio/compteur-de-greve.git
synced 2024-12-18 05:41:56 +00:00
respect reduced motion for counter animation
This commit is contained in:
parent
419358852d
commit
a9cdc16f2a
1 changed files with 17 additions and 13 deletions
|
@ -67,6 +67,9 @@ document.addEventListener('alpine:init', () => {
|
|||
})
|
||||
|
||||
function animateRange(duration, start, end, callback) {
|
||||
if (matchMedia("(prefers-reduced-motion)").matches) {
|
||||
callback(end)
|
||||
} else {
|
||||
let startTimestamp = null;
|
||||
|
||||
const step = (timestamp) => {
|
||||
|
@ -82,7 +85,8 @@ function animateRange(duration, start, end, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
requestAnimationFrame(step);
|
||||
requestAnimationFrame(step)
|
||||
}
|
||||
}
|
||||
|
||||
function formatNumber(number) {
|
||||
|
|
Loading…
Reference in a new issue