Skip to content

Commit

Permalink
[Question]: Would u like to add preloader to ur index page?
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjaliavv51 committed May 22, 2024
1 parent e2c9831 commit 5e609de
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@
- Audio file for click sound
-->
<audio id="clickSound" src="./assets/audio/click-sound.wav"></audio>
<style>
.preloader{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: black;
transition: opacity 5s, visibility 5s;
z-index: 1000;
}

.preloader--hidden{
opacity: 0;
visibility: hidden;
}
.preloader img{
height: 200px;
width: 200px;
border-radius: 1000px;
}
</style>
</head>
<!-- Light-Dark theme SWITCH -->

Expand All @@ -76,6 +101,20 @@
</label> -->

<body>
<div class="preloader">
<img src="loader.gif" class="center">
</div>
<script>
window.addEventListener("load", () => {
const loader = document.querySelector(".preloader");

loader.classList.add("preloader--hidden");

loader.addEventListener("transitionend", () => {
document.body.removeChild(loader);
});
});
</script>
<div class="cursor"></div>
<!-- BACKGROUND PARTICLES -->
<!-- <div class="page-bg"></div> -->
Expand Down
Binary file added loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5e609de

Please sign in to comment.