Jump to content
Search Community

Lazy load videos using scrolltrigger

andrewandopen test
Moderator Tag

Recommended Posts

Hey there,

I'm working on a site that has multiple videos on my homepage. I'm trying to improve it's performance by only loading videos that sit below the fold when they come into view. I'm trying to use scrolltrigger for this. I've been referencing this post, however it seems extremely complicated and is relevant to images as opposed to videos. 

Does anyone have any simple solution here?

Thanks in advance

Link to comment
Share on other sites

Hi,

 

Ryan (@elegantseagulls) already provided a good approach in that particular thread:

Using the isInViewport method with the top of the element, should return the percentage of the viewport(on a 0 to 1 value) that the top of the element is from the top of the viewport. So for example 1.1 means 110%. In a screen with 1080px height that is 1188px from the top of the viewport or 108px below the fold. So that would be a good point to load your videos.

 

If you keep having issues, please include a minimal demo in order to get a better idea of what the problem could be.

 

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...