У меня есть несколько разделов в форме. В каждом разделе есть индикатор того, на каком этапе находится пользователь. Я хочу, чтобы при фокусировке ввода внутри раздела на индикаторе начиналась анимация. Я не могу использовать: focus-inside, потому что сейчас он не является стандартом браузера.
Прямо сейчас я сохранил импульсную анимацию как эффект наведения, но я хотел бы, чтобы эта анимация запускалась, когда вход сфокусирован. Я думал об использовании JQuery, но сам не смог разобраться.
Любая помощь будет принята с благодарностью.
@keyframes pulse {
0%,
40% {
box-shadow: 0 0 0 5px rgba(0, 109, 168, 0);
}
0% {
box-shadow: 0 0 0 0px rgba(0, 109, 168, 0.5);
}
100% {
box-shadow: 0 0 0 0px rgba(0, 109, 168, 0);
}
}
#indicator {
background-color: #006da8;
width: 25px;
height: 25px;
border-radius: 50%;
padding: 0;
margin-top: 15px;
margin-bottom: 15px;
}
#indicator:hover {
animation: pulse 2s ease infinite;
}
#indicator p {
padding-top: 3px;
margin: 5px;
color: white;
text-align: center;
}
input {
display: block;
margin: 10px 0 10px 0;
}
/* what i think i want to do? */
input:focus {
/* somehow start indicator animation???
Maybe use javascript? */
}
<form>
<section>
<div id="indicator">
<p>1</p>
</div>
<input type="text" />
<input type="email" />
<input type="password" />
</section>
<section>
<div id="indicator">
<p>2</p>
</div>
<input type="text" />
<input type="email" />
<input type="password" />
</section>
<section>
<div id="indicator">
<p>3</p>
</div>
<input type="text" />
<input type="email" />
<input type="password" />
</section>
</form>