0
Fala Galera!
I can’t seem to get my preloader function correctly, because even declaring in the function the delay via setTimeout is not executed. At the same time, my fadeOut is not respecting the time I set, skipping direct and no effect to the application start page.
I need it to run independent of the site loading time for 6 second(gif exec time).
(is an angular application, feel free to indicate native solutions from the angular as well)
Thanks in advance for the help!!!
<script type="text/javascript">
window.addEventListener("load", function () {
setTimeout(function () {
const loader = document.querySelector(".loader");
loader.className += " hidden"; // class "loader hidden"
}, 6000);
});
</script>
### CSS ###
.loader.hidden {
animation: fadeOut 4s;
animation-fill-mode: forwards;
}
@keyframes fadeOut {
100% {
opacity: 0;
visibility: hidden;
}
}