File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # preloader {
2+ position : fixed;
3+ top : 0 ;
4+ left : 0 ;
5+ width : 100% ;
6+ height : 100% ;
7+ background-color : # f5f5f5 ;
8+ z-index : 9999 ;
9+ }
10+
11+ .spinner {
12+ position : absolute;
13+ top : 50% ;
14+ left : 50% ;
15+ transform : translate (-50% , -50% );
16+ border : 4px solid # ccc ;
17+ border-top-color : # 3498db ;
18+ border-radius : 50% ;
19+ width : 40px ;
20+ height : 40px ;
21+ animation : spin 1s linear infinite;
22+ }
23+
24+ @keyframes spin {
25+ 0% { transform : rotate (0deg ); }
26+ 100% { transform : rotate (360deg ); }
27+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Preloader Example</ title >
7+ < link rel ="stylesheet " href ="css/style.css ">
8+ </ head >
9+ < body >
10+ < div id ="preloader ">
11+ < div class ="spinner "> </ div >
12+ </ div >
13+
14+ < div id ="content " style ="display:none; ">
15+ <!-- Your main content goes here -->
16+ < h1 > Welcome to my website! codeswithpankaj.com</ h1 >
17+ < p > This is the main content of the page.</ p >
18+ </ div >
19+
20+ < script src ="js/p4n.js "> </ script >
21+ </ body >
22+ </ html >
Original file line number Diff line number Diff line change 1+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2+ var preloader = document . getElementById ( 'preloader' ) ;
3+ var content = document . getElementById ( 'content' ) ;
4+
5+ // Hide the preloader and show the main content after 2 seconds
6+ setTimeout ( function ( ) {
7+ preloader . style . display = 'none' ;
8+ content . style . display = 'block' ;
9+ } , 2000 ) ;
10+ } ) ;
You can’t perform that action at this time.
0 commit comments