I want to maintain the loading screen for a minimum of 4 seconds. However, the timer at the end does not seem to be functioning as expected. Here is the code snippet I am using:
window.addEventListener("load", () => {
const preload = document.querySelector('.preload');
preload.classList.add('preload-finish');
}, 4000);