I am trying to implement a new pulse animation in my project
However, it is not working as expected. How can I resolve this issue and identify the root cause?
I would like the circle to pulse when clicked (just one click without holding down) and then stop after 2 seconds
var abox = document.getElementsByClassName("pulsediv")[0];
function pulsing() {
abox.classList.toggle("pulse");
}
@import "compass/css3";
body, html {
height: 100%;
background: #fff;
}
.pulsediv {
position: relative;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
display: block;
width: 100px;
height: 100px;
font-size: 1.3em;
font-weight: light;
font-family: 'Trebuchet MS', sans-serif;
text-transform: uppercase;
text-align: center;
line-height: 100px;
letter-spacing: -1px;
color: white;
border: none;
border-radius: 50%;
background: #5a99d4;
cursor: pointer;
box-shadow: 0 0 0 0 rgba(#5a99d4, .5);
}
.pulse {
animation: pulse 2s;
}
@-webkit-keyframes pulse {
0% {
@include transform(scale(.9));
}
70% {
@include transform(scale(1));
box-shadow: 0 0 0 50px rgba(#5a99d4, 0);
}
100% {
@include transform(scale(.9));
box-shadow: 0 0 0 0 rgba(#5a99d4, 0);
}
}
<span class="pulsediv" onclick="pulsing">Hot</span>