У меня есть простой многошаговый анимированный индикатор выполнения, который я хочу показать на своих страницах. Каждый шаг анимации будет отображаться на каждой странице.
Проблема, с которой я сталкиваюсь, связана со свойствами анимации CSS. Я определил свойства анимации для него, но это не анимация. Я потратил бесчисленные часы, пытаясь найти что-то не так, но безрезультатно.
Пробная проверка, если css был переопределен, оказывается, что он переопределяется, но сам по себе, а не из другого CSS, так что Вы потеряли дело.
Можете ли вы, ребята, помочь мне с этой проблемой?
Ниже приведен код, который я использую:
const step1 = document.getElementById('step1');
const step2 = document.getElementById('step2');
const step3 = document.getElementById('step3');
const step4 = document.getElementById('step4');
step1.classList.remove("is-active");
step1.classList.add("is-complete");
step2.classList.add("is-active");
.progressreview {
position: relative;
display: flex;
}
.progressreview .progressreview-track {
position: absolute;
top: 5px;
width: 100%;
height: 5px;
background-color: #dfe3e4;
z-index: -1;
}
.progressreview .progressreview-step {
position: relative;
width: 100%;
font-size: 12px;
text-align: center;
}
.progressreview .progressreview-step:last-child:after {
display: none;
}
.progressreview .progressreview-step:before {
content: "\f00c";
display: flex;
margin: 0 auto;
margin-bottom: 10px;
width: 10px;
height: 10px;
background: #fff;
border: 4px solid #dfe3e4;
border-radius: 100%;
color: #fff;
}
.progressreview .progressreview-step:after {
content: "";
position: absolute;
top: 6px;
left: 50%;
width: 0%;
transition: width 1s ease-in;
height: 5px;
background: #dfe3e4;
z-index: -1;
}
.progressreview .progressreview-step.is-active {
color: #2183dd;
}
.progressreview .progressreview-step.is-active:before {
border: 4px solid #777;
animation: pulse 2s infinite;
}
.progressreview .progressreview-step.is-complete {
color: #009900;
}
.progressreview .progressreview-step.is-complete:before {
font-family: FontAwesome;
font-size: 10px;
color: #fff;
background: #009900;
border: 4px solid transparent;
}
.progressreview .progressreview-step.is-complete:after {
background: #2183dd !important;
animation: nextStep 1s !important;
animation-fill-mode: forwards !important;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(33, 131, 221, 0.4);
}
70% {
box-shadow: 0 0 0 10px rgba(33, 131, 221, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(33, 131, 221, 0);
}
}
@keyframes nextStep {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
<div class="progressreview">
<div class="progressreview-track"></div>
<div id="step1" class="progressreview-step">
Step One
</div>
<div id="step2" class="progressreview-step">
Step Two
</div>
<div id="step3" class="progressreview-step">
Step Three
</div>
<div id="step4" class="progressreview-step">
Complete
</div>
</div>
Результат:
Какой он должен быть:
Было бы очень хорошо, если бы кто-нибудь мог мне помочь в этом.
Спасибо.