57 lines
1.4 KiB
HTML
57 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>rich and strong</title>
|
|
<style>
|
|
body,
|
|
html {
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</body>
|
|
<script>
|
|
var index = 0;
|
|
var body = document.querySelector("body")
|
|
body.onclick = function (event) {
|
|
// console.log(event)
|
|
var x = event.x;
|
|
var Y = event.y;
|
|
var Text = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
|
|
index > 11 ? index = 0 : '';
|
|
// console.log(Text[index])
|
|
var span = document.createElement("span");
|
|
span.innerText = Text[index];
|
|
span.style = `
|
|
position: fixed;
|
|
left: ${x}px;
|
|
top: ${Y}px;
|
|
transition: all ease 1s;
|
|
opacity: 1;
|
|
color: hsla(${parseInt(Math.random() * 360)},100%,50%);`;
|
|
|
|
body.appendChild(span)
|
|
|
|
console.log(span)
|
|
animation(span,Y);
|
|
index++
|
|
}
|
|
function animation(a,y) {
|
|
setTimeout(function (){
|
|
a.style.opacity = 0
|
|
a.style.top = `${y-100}px`
|
|
},100)
|
|
setTimeout(function (){
|
|
body.removeChild(a)
|
|
},1100)
|
|
}
|
|
</script>
|
|
|
|
</html> |