Files
ClassContent/历届学生/18课程/class18_2/项目/上课项目/tabs/fq.html
2024-09-27 02:06:13 +08:00

62 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
margin: 0;
padding: 0;
}
body,html{
width: 100%;
height: 100%;
position: relative;
}
span {
transition: all 1s ease;
user-select: none;
}
</style>
</head>
<body>
</body>
<script>
var body = document.querySelector("body"), index = 0;
body.onclick = function (event) {
var x = event.x, y = event.y;
var Text = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
var span = document.createElement("span");
span.innerText = Text[index];
span.style = `
color: hsl(${parseInt(Math.random() * 360)},100%,50%,1);
position: absolute;
opacity: 1;
left: ${x - 32}px;
top: ${y - 21}px
`;
body.appendChild(span);
setTimeout(function(){
span.style.top = `${y - 150}px`;
span.style.opacity = 0
},100)
setTimeout(function(){
body.removeChild(span)
},1100)
index++;
index >= 12 ? index = 0 : ''
}
</script>
</html>