html
html
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="preloader">
<div class="loader"></div>
</div>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#preloader {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #142718;
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.loader {
transform: scale(1);
transition: transform 2s ease-in;
width: 70px;
height: 70px;
border-radius: 50%;
border: 8px solid #444444;
border-top: 8px solid darkorange;
animation: spin 1.2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// In your theme's footer.php or create a new script file
document.addEventListener("DOMContentLoaded", function() {
setTimeout(function () { //simulate loading...
var animatedElement = document.querySelector('.loader');
/*Code for zoom in does not work, I look forward to your help.
//cancel first animation to start zoom in
animatedElement.style.animation = 'none';
//start transforming
animatedElement.style.transform = 'scale(30)';
animatedElement.addEventListener('transitionend', function () {
console.log('Transition done');
document.getElementById("preloader").style.display = "none";
}, false);
*/
// Hide the preloader when the page is loaded
document.getElementById("preloader").style.display = "none";
}, 3000);
});
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Laufen