There was a requirement of showing a pulse animation over a label so as to highlight outstanding notifications. I came across this while researching online and have implemented the same. It works well, however, when the label is pulsing, the CPU usage is at a constant 50% while normally there is hardly anything. I would like to understand what or why this is happening, and if possible, a fix.
CSS:
.pulse {
/*margin:100px;*/
display: block;
/*width: 22px;*/
/*height: 22px;*/
/*border-radius: 100%;*/
background: #cca92c;
cursor: pointer;
box-shadow: 0 0 0 rgba(204,169,44, 0.4);
animation: pulse 2s infinite;
}
.pulse:hover {
animation: none;
}
@-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
@keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
box-shadow: 0 0 0 0 rgba(196,33,61, 0.85);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
box-shadow: 0 0 0 10px rgba(204,169,44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
html:
<a class="dropdown-toggle" data-toggle="dropdown" id="alertingDashboardDropdown" href="#">Alerts Dashboard
<span class="label {{alertCount.totalOpenAlertsLabelClass}} dropdown-subscript-white pull-right">{{alertCount.totalOpenAlerts}}</span>
</a>
.
.
{{alertCount.totalOpenAlertsLabelClass}} basically returns "label-primary pulse"