那你把上面的转化成能直接运行的网页,我打开看看想过
时间: 2024-03-26 15:40:53 浏览: 112
很抱歉,我无法提供直接运行的网页。但你可以把上面的代码复制到一个 HTML 文件中,然后在浏览器中打开这个 HTML 文件,就可以看到加载动画的效果了。以下是完整的 HTML 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>加载动画</title>
<style type="text/css">
#load {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9999;
background-color: #fff;
}
.loader {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
.loader-inner {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
width: 60px;
height: 60px;
}
.loader-line-wrap {
position: relative;
width: 100%;
height: 100%;
transform-origin: center;
animation: loader-rotate 1.2s linear infinite;
}
.loader-line {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 7px;
background-color: #000;
animation: loader-line-scale 1.2s ease-in-out infinite;
}
.loader-line:nth-child(1) {
transform: rotate(0deg);
animation-delay: calc(100ms * 1);
}
.loader-line:nth-child(2) {
transform: rotate(60deg);
animation-delay: calc(100ms * 2);
}
.loader-line:nth-child(3) {
transform: rotate(120deg);
animation-delay: calc(100ms * 3);
}
.loader-line:nth-child(4) {
transform: rotate(180deg);
animation-delay: calc(100ms * 4);
}
.loader-line:nth-child(5) {
transform: rotate(240deg);
animation-delay: calc(100ms * 5);
}
.loader-line:nth-child(6) {
transform: rotate(300deg);
animation-delay: calc(100ms * 6);
}
@keyframes loader-rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes loader-line-scale {
0%, 100% {
transform: scaleY(0.5);
}
50% {
transform: scaleY(1);
}
}
</style>
</head>
<body>
<div id="load">
<div class="loader">
<div class="loader-inner">
<div class="loader-line-wrap">
<div class="loader-line"></div>
</div>
<div class="loader-line-wrap">
<div class="loader-line"></div>
</div>
<div class="loader-line-wrap">
<div class="loader-line"></div>
</div>
<div class="loader-line-wrap">
<div class="loader-line"></div>
</div>
<div class="loader-line-wrap">
<div class="loader-line"></div>
</div>
<div class="loader-line-wrap">
<div class="loader-line"></div>
</div>
</div>
</div>
</div>
<div id="contents">
<!-- 这里放你的网页内容 -->
</div>
<script>
document.onreadystatechange = function () {
var state = document.readyState
if (state == 'interactive') {
document.getElementById('contents').style.visibility="hidden";
} else if (state == 'complete') {
setTimeout(function(){
document.getElementById('interactive');
document.getElementById('load').style.visibility="hidden";
document.getElementById('contents').style.visibility="visible";
},1000);
}
}
</script>
</body>
</html>
```
你只需要将 `<div id="contents">` 标签中的内容替换为你自己的网页内容即可。
阅读全文