64 lines
1.4 KiB
HTML
64 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>富强明主</title>
|
|
<style>
|
|
html {
|
|
height: 100%;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
height: 100%;
|
|
position: relative;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</body>
|
|
<script>
|
|
var index = 0,
|
|
body = document.querySelector("body");
|
|
body.onclick = function(e) {
|
|
|
|
var x = e.x;
|
|
var y = e.y;
|
|
var Text = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
|
|
|
|
var span = document.createElement("span")
|
|
span.innerText = Text[index];
|
|
span.style = `
|
|
position: absolute;
|
|
left: ${x}px;
|
|
top: ${y}px;
|
|
color: hsla(${parseInt(Math.random() * 360)},100%,50%,1);
|
|
opacity: 1;
|
|
transition: all ease 1s;
|
|
`;
|
|
|
|
body.appendChild(span)
|
|
console.log(span);
|
|
|
|
setTimeout(() => {
|
|
span.style.top = (parseInt(span.style.top) - 150) + 'px'
|
|
span.style.opacity = 0
|
|
}, 100);
|
|
|
|
setTimeout(() => {
|
|
body.removeChild(span)
|
|
}, 1300);
|
|
|
|
|
|
index += 1
|
|
index >= 12 ? index = 0 : ''
|
|
}
|
|
</script>
|
|
|
|
</html> |