website/js/loader.js
2021-07-21 17:07:52 +02:00

19 lines
No EOL
575 B
JavaScript

let div = document.createElement("div");
div.className = "loader";
div.innerHTML = `<div class="loader-dots">
<div class="dots"></div>
<div class="dots"></div>
<div class="dots"></div>
<div class="dots"></div>
<div class="dots"></div>
</div>`;
document.body.classList.add("stop-scrolling");
document.body.appendChild(div);
document.addEventListener('readystatechange', event => {
if (event.target.readyState === "complete") {
document.querySelector(".loader").style.display = "none";
document.body.classList.remove("stop-scrolling");
}
});