Can I optimize CSS animation not to run when the animate object not need to be display (it’s not on the view port)?
Thanks!
Can I optimize CSS animation not to run when the animate object not need
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you could detect when the object IS in view port, you could add/remove the css class with the animation description. Something like:
The tricky part is to check when the object is not in view port anymore. In my opinion, constantly checking if the object is in view port and preventing animation will bring more harm than good, since css animations are lightweight and work very well.