1
I have a page index.html
containing a <p id="valor">
Which is updated via a Websocket using javascript.
Every time the server sends the message the function atualizar(valor)
is called:
function atualizar(valor) {
document.getElementById("valor").innerText = valor;
document.getElementById("valor").style.animation = "example 1s 1";
}
body {
background: #333;
}
#valor {
color: #FFFFFF;
font-family: "Trebuchet MS", Arial;
margin-top: 5px;
font-size: 36px;
font-weight: bold;
}
@keyframes example {
50% {
font-size: 45px;
}
100% {
font-size: 36px;
}
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
transform: translate3d(-4px, 0, 0);
}
40%,
60% {
transform: translate3d(4px, 0, 0);
}
}
<input type="text" onblur="atualizar(this.value);" />
<p id="valor">Meu texto padrão</p>
The idea is that always when updating the value it makes with the text an animation Scale and Shake Effect. The problem is that he only works the first time that the function is called.
Matheus, was the answer enough to solve your problem? If yes, please accept the question as resolved, otherwise ask your questions. Thank you!
– ℛɑƒæĿᴿᴹᴿ