Skip to content

Commit

Permalink
Remove Preloader from webpage
Browse files Browse the repository at this point in the history
  • Loading branch information
Roozbehmd committed Jan 9, 2025
1 parent df0aa94 commit d495fc3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified assets/.DS_Store
Binary file not shown.
23 changes: 15 additions & 8 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ document.addEventListener('DOMContentLoaded', () => {
/**
* 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
*/
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h2>I'm <span id='nameHolder' >Roozbeh Moayyedian</span>, a Toronto-based digita

<a href="#" class="scroll-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

<div id="preloader">
<!-- <div id="preloader">
<div class="line"></div>
</div>
</div> -->

<!-- Vendor JS Files -->
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
Expand Down Expand Up @@ -412,9 +412,9 @@ <h2>I'm <span id='nameHolder' >Roozbeh Moayyedian</span>, 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);
Expand Down

0 comments on commit d495fc3

Please sign in to comment.