0

I m building a website where i m using some gif file but the gifs start animating as soon as the page loads. I want them to trigger as the user scroll on to the particular gif section i.e current viewport. See example: http://www.invisionapp.com/

I have searched the entire internet but couldnt get the simplest way of doint that. Anybody having any idea please assist.

2 Answers2

0

The website you have shared is using something known as lazyload. It will load images/videos only on scroll.

For some lazyload alternatives, please refer to these:

- How to lazy load natively

- Vanilla lazy load library on Github

Diego Fortes
  • 8,830
  • 3
  • 32
  • 42
-1

What you can do is use two images, one static and one which has an animation. So, when user scrolls over target, in your case viewport, then, you replace a static image with the animated gif image.

Pramod
  • 622
  • 9
  • 21