Skip to content

Commit 89e07b1

Browse files
authored
Preloader Example update
1 parent b705fbb commit 89e07b1

3 files changed

Lines changed: 59 additions & 0 deletions

File tree

Example/preloader/css/style.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
}

Example/preloader/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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>

Example/preloader/js/p4n.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
});

0 commit comments

Comments
 (0)