当前位置:网站首页>The reduce function builds flaunting fonts and font animations.
The reduce function builds flaunting fonts and font animations.
2022-07-20 15:12:00 【Jason–json】
<!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>Document</title>
<style>
* {
padding: 0px;
margin: 0px;
}
body {
width: 300vh;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #34495e;
}
div {
font-size: 3em;
font-weight: bold;
text-transform: uppercase;
color: #9b599b;
}
div>span {
position: relative;
display: inline-block;
}
.color {
animation-name: color;
animation-duration: 1s;
animation-iteration-count: 2;
animation-timing-function: linear;
animation-direction: alternate;
}
@keyframes color {
50% {
color: #f1c40f;
transform: scale(2);
}
to {
color: #e7c3ce;
transform: scale(0.5);
}
}
</style>
</head>
<body>
<div>shihuayingkejishukejifazhanyouxiangongsi</div>
</body>
<script>
{
let divs = document.querySelector("div")
// console.log(divs.textContent)
let arrDiv = [...divs.textContent] // Get text content
console.log(arrDiv)
arrDiv.reduce((pre, cur, index) => { //reduce Method cycle
if (pre === index) {
divs.innerHTML = ''
}
let span = document.createElement("span")// Get the split text and add labels
span.innerHTML = cur
divs.appendChild(span)
span.addEventListener("mouseover", () =>
span.classList.add("color"),
console.log(pre, cur)
)
// End of listening animation Remove class
span.addEventListener("animationend", function () {
span.classList.remove("color")
})
}, 0)
}
</script>
</html>
Special thanks to the backers , For more front-end knowledge, please log in The backing people
边栏推荐
- ACL 2022 | Text-to-Table:一种新的信息抽取任务
- 图论复习usaco2006jan gold分离的路径
- 请问,现在有什么短期的理财产品值得买?
- Read write separation standby backup error
- Build a full stack web application framework in 1 hour, support secondary development, and update and expand at any time
- 装饰器解决TypeError: ‘NoneType‘ object is not callable
- Southern Cass 10.1 software installation package download and installation tutorial
- Was expecting double quote to start field name error
- 组合数学学习笔记(未完待续
- C#/VB.NET 添加多行文本水印到Word文档
猜你喜欢
How to choose aion LX plus and velai ES6, the top products of high-end pure electric SUV?
容斥【BZOJ3622】已经没有什么好害怕的了
在线XML转JSON工具
基于Xlinx的时序分析与约束(1)----什么是时序分析?什么是时序约束?什么又是时序收敛?
不等式学习笔记
unet和mask rcnn
Cloud Native Core Technology: Service Mesh Implementation - istio
Exercice récursif fonctionnel (version Easy)
组合数学学习笔记(未完待续
EXCRT/扩展中国剩余定理学习笔记
随机推荐
Rong Tui [jsoi2011] special products
was expecting double-quote to start field name错误
mindspore 8卡V100训练到101个epoch的时候报读取数据超时的错误
[jsoi2007] important cities
基于Xlinx的时序分析与约束(1)----什么是时序分析?什么是时序约束?什么又是时序收敛?
[pkusc2018] main fighting ground of provincial selection and special training
装饰器解决TypeError: ‘NoneType‘ object is not callable
全球1000+研究员在Twitter直播训练超大模型??
省选专练之 [HAOI2009]毛毛虫
[JSOI2007]重要的城市
First knowledge of C language
帆软报表数据集sql
There is no database shortcut icon in the start menu
C语言初识
unet和mask rcnn
#导入Word文档图片# 内核同步与互斥
Example | apicloud AVM framework encapsulates the cascade selection bullet frame of provinces and cities
使用Masonry实现控件(包括UITableView)根据内容进行宽度自适应和高度自适应
Comparison of eolink and JMeter interface tests
省选专练之GCD生成树