jquery remove class after css animation played?

后端 未结 6 1708
甜味超标
甜味超标 2021-01-04 11:06

I have the css code:

body.start{-webkit-animation:srcb ease-in .4s 1;}

and just play once when entered the website

but the problem

6条回答
  •  有刺的猬
    2021-01-04 11:58

    What worked for me was to always remove the animation class at the start of the event listener, run some small code in-between and then add the animation class again and it worked. It will now always trigger the animation. In my case I wanted a wobble animation to be triggered if the password was wrong. Not sure of your reasoning. I wanted the animation removed so the animation would always trigger again, even if they repeatedly hit submit and it was wrong.

    $j('#submitLogin').on('click',function(){    
        if(true){
           //login
        }else{
           $j('.lockIcon').removeClass('wobble-hor-top');
           $j(this).prev().prev().addClass('invalid');
           $j('.loadIconKey').hide();
           $j('.lockIcon').addClass('wobble-hor-top');
        }
    });
    

提交回复
热议问题