html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|<!--Copy the code below into your starting page, just delete the loading simulation-->
<html>
<body>
<div id="preloader">
<div class="loader"></div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
setTimeout(function () { //simulate loading, can be removed
document.getElementById("preloader").classList.add("okloaded");
}, 1000);
});
setTimeout(function () { //If loading takes a long time, remove preloader after 5 seconds at the latest.
document.getElementById("preloader").classList.add("okloaded");
}, 4000); //4s + 1s animation delay
</script>
</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;
transform-origin:center;
}
.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); }
50% { transform: rotate(180deg) scale(1.1); }
Enter to Rename, Shift+Enter to Preview
js
js
1
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Laufen