From d495fc3114ae156a5adae185365ed236b7ff5b38 Mon Sep 17 00:00:00 2001 From: Roozbehmd Date: Thu, 9 Jan 2025 14:28:28 -0500 Subject: [PATCH] Remove Preloader from webpage --- .DS_Store | Bin 6148 -> 6148 bytes assets/.DS_Store | Bin 8196 -> 8196 bytes assets/js/main.js | 23 +++++++++++++++-------- index.html | 8 ++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.DS_Store b/.DS_Store index 63ee67af0db2253575941bce2cc2d68e7b37fe49..7aaf77d62a99ad52e76300b350636bd3d7a6c370 100644 GIT binary patch delta 173 zcmZoMXffEJ%2IDBG>w6QfrUYjA)O(Up(Hoo#U&{xKM5$t@yV>NhvWWHM^yO~yz&JZ zhQZ1CxdlKy49t!KAc~D4k)ap}QyEGaij&HV3!vujOe)C9oVzFpPbNuB80Qkr(*#H0l delta 172 zcmZoMXffEJ%2KaBqnUw$frUYjA)O(Up(Hoo#U&{xKM5$tG1q(LH|IY`98u*{@X8lt z7zQWj=N16 { /** * Preloader */ + // const preloader = document.querySelector('#preloader'); + // if (preloader) { + // window.addEventListener('load', () => { + // setTimeout(() => { + // preloader.classList.add('loaded'); + // }, 1000); + // setTimeout(() => { + // preloader.remove(); + // }, 2000); + // }); + // } const preloader = document.querySelector('#preloader'); if (preloader) { - window.addEventListener('load', () => { - setTimeout(() => { - preloader.classList.add('loaded'); - }, 1000); - setTimeout(() => { - preloader.remove(); - }, 2000); + window.addEventListener('DOMContentLoaded', () => { + // Immediately remove the preloader + preloader.classList.add('loaded'); + preloader.remove(); }); } - /** * Mobile nav toggle */ diff --git a/index.html b/index.html index 01c11d8..7a20a5a 100644 --- a/index.html +++ b/index.html @@ -367,9 +367,9 @@

I'm Roozbeh Moayyedian, a Toronto-based digita -
+ @@ -412,9 +412,9 @@

I'm Roozbeh Moayyedian, a Toronto-based digita document.title = tempTitle; document.getElementById("nameHolder").innerHTML = ' ' + tempTitle + ' '; - // Check elapsed time (8 seconds) and update the entire string if needed + // Check elapsed time (5 seconds) and update the entire string if needed const currentTime = new Date().getTime(); - if (currentTime - startTime >= 8000) { + if (currentTime - startTime >= 5000) { document.title = name; document.getElementById("nameHolder").innerHTML = ' ' + name + ' '; clearInterval(nameSetter);