-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #594 from PulkitShubham/main
Added a lottie animation loader to the website
- Loading branch information
Showing
3 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.loader { | ||
width: 120px; /* Adjust size */ | ||
height: 120px; /* Adjust size */ | ||
position: fixed; /* Stay fixed in the center */ | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
z-index: 9999; | ||
} | ||
|
||
/* Main content styling */ | ||
.main-content { | ||
display: none; | ||
opacity: 0; | ||
} | ||
|
||
/* Show content when page is loaded */ | ||
body.loaded .loader { | ||
display: none; /* Hide loader */ | ||
} | ||
|
||
body.loaded .main-content { | ||
display: block; /* Show main content */ | ||
animation: fadeIn 1s ease-in-out forwards; /* Fade in animation */ | ||
} | ||
|
||
body.loaded .popup { | ||
display: flex; /* Show popup after loading */ | ||
} | ||
|
||
/* Smooth fade-in effect for content */ | ||
@keyframes fadeIn { | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
/* Body styling to prevent scrolling while the loader is visible */ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
overflow: hidden; /* Prevent scrolling while loader is visible */ | ||
background-color: #f0f4f8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Load Lottie animation | ||
const loader = document.getElementById("loader"); | ||
const animation = lottie.loadAnimation({ | ||
container: loader, // the DOM element that will contain the animation | ||
renderer: "svg", // the rendering method | ||
loop: true, // loop the animation | ||
autoplay: true, // start playing the animation | ||
path: "https://lottie.host/f0db1198-7725-40df-91d4-15dcf396f3a2/vyKXUMpsxT.json", // the path to the animation JSON | ||
}); | ||
|
||
window.onload = function () { | ||
setTimeout(function () { | ||
// Stop the animation and go to the last frame | ||
animation.stop(); | ||
document.body.classList.add("loaded"); | ||
}, 1500); // 1.5-second delay | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters