Animate Gif Featured Image on Scroll (viewport).

[ad_1]

I can set featured images as a gif, and I know how to style the featured images from their div container, but I’m wondering how it’d be possible to only animate the gif while it’s in the viewport? Does this require JavaScript, and would it slow down page speed considerably?
I want to copy what a lot of VOD sites do that play a preview of the video (WEBP or GIF) while it’s in view before clicking on it.

[ad_2]
1 Comment
  1. Yes it requires JavaScript. Most sites use mp4 now as gif are extremely heavy for video files as they don’t have compression. Look into the new JS “intersection observer”

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer