Skip to content
Advertisement

How to achieve lazy loading animation effect through javascript

I would like to ask everyone. I hope to make an effect. When the page is loaded, I can delay the transparency of the background for 2 seconds, and let the duck in the middle hide from the middle of the screen and slowly enlarge and appear.

But I have just learned javascript and CSS, and now I found a problem that the duck doesn’t seem to be enlarged from the center point. I don’t know why? In addition, I want to trigger the animation with a delay of two seconds after the page is loaded. Is this way of writing OK? Since I’m a beginner, I don’t know if this way of writing is correct?

Thanks for watching my question

JavaScript
JavaScript
JavaScript

Advertisement

Answer

Try to put the scale of duck to 0, or opacity of duck to 0 from the start, or apply css animation to .duck class. Not sure what are you trying to achieve.

Advertisement