So now I have made jQuery Ajax code that checks the username and password are correct. But instead of just displaying an error message, I would also like to shake the item.
Identify the shake?
Such a concussion that Wordpress has. Go to wordpress.com/wp-login.php and fill in some random information there and the element will shake.
Shake can be performed by Animate.css .
What is the problem?
If login fails, jQuery does this.
$('.element').addClass('shake');
But since the shake element has a CSS animation that runs only once, we donβt need the CSS shake class after it has shaken the element.
So I tried:
$('.element').addClass('shake').removeClass('shake');
But this is happening too fast.
So I tried again:
$('.element').addClass('shake').delay(1000).removeClass('shake');
Do not play the animation, and then remove the .shake class from .element . If the user enters incorrect data more than once, then shaking will not work.
You can play the violin here .
The goal is to shake the item more than once by pressing the Shake button.
Mirorauhala
source share