Clamp progress bar to 100%

This commit is contained in:
Sijmen 2023-05-02 02:00:44 +02:00
parent e03e48d08f
commit b81227265c
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

View file

@ -75,7 +75,7 @@
progressInterval = window.setInterval(() => { progressInterval = window.setInterval(() => {
elapsed += 1.0; elapsed += 1.0;
let progress = elapsed / duration; let progress = Math.min(elapsed / duration, 1.0);
progressBar.style.width = `${progress * 100}%`; progressBar.style.width = `${progress * 100}%`;
}, 1000); }, 1000);
{% endif %} {% endif %}