From 5514197ce4626dd9675b06597d8415f9bf808c97 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Sun, 31 Jan 2021 19:50:11 -0500 Subject: [PATCH] Fix preloader overlay not being removed --- js/custom.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/custom.js b/js/custom.js index c7ae577..d6dd189 100644 --- a/js/custom.js +++ b/js/custom.js @@ -95,6 +95,11 @@ window.addEventListener("DOMContentLoaded", function () { }); -window.addEventListener("load", function () { +window.addEventListener("load", async function () { document.getElementById("preloader").classList.add("fadeout"); + // I don't actually know how promises or async works + // ¯\_(ツ)_/¯ + // https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep + await new Promise(r => setTimeout(r, 250)) + document.getElementById("preloader").style.display = "none"; });