console
let dom = document.querySelector('.voice')
let domItem = document.querySelector('.voice-item')
let domItemLi = document.querySelectorAll('.voice-item li')
let isTrue = false;
dom.addEventListener('click', (ev) => {
isTrue = !isTrue
if (isTrue) {
for(var i = 0; i < domItemLi.length; i++) {
domItemLi[i].classList.add('active')
}
} else {
for(var i = 0; i < domItemLi.length; i++) {
domItemLi[i].classList.remove('active')
}
}
})
<div class="voice">
<ul class="voice-item">
<li></li>
<li></li>
<li></li>
</ul>
</div>
* {
padding: 0;
margin: 0;
}
li {
list-style: none;
}
.voice {
width: 120px;
height: 50px;
background: #ffffff;
}
.voice .voice-item {
position: relative;
width: 50px;
height: 50px;
transform: rotate(135deg) scale(0.6);
overflow: hidden;
margin-left: 0px;
}
.voice .voice-item li {
position: absolute;
border: 5px solid #000000;
border-radius: 50%;
}
.voice .voice-item li:nth-child(1) {
width: 8px;
height: 8px;
left: 44px;
top: 44px;
}
.voice .voice-item li:nth-child(2) {
width: 24px;
height: 24px;
left: 34px;
top: 34px;
}
.voice .voice-item li.active:nth-child(2) {
animation: fade 1s infinite 0s;
}
.voice .voice-item li:nth-child(3) {
width: 40px;
height: 40px;
left: 24px;
top: 24px;
}
.voice .voice-item li.active:nth-child(3) {
animation: fade 1s infinite 0.2s;
}
@keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}