Skip to content

tugbucket/lazy-load-videos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lazy Load Videos

Plays and pauses videos when entering and leaving the viewport. Can also load videos when entering the viewport.

Shortcode options

[lazyloadvideos pauseonscroll="yes"]

The parameters are yes and no

By default it’s set to yes. The videos should start playing when you scroll into view and pause when scrolling out of view. If set to no, the videos start playing when scrolled into view and do not pause after scrolling out of view.

Notes

To lazy load the videos, meaning only loading them when scrolled into view, you have to alter your HTML video tag.

For example: <video src="<path to your video>"></video>

Change that to: <video data-src="<path to your video>"></video>

Note that the new HTML does not contain an src attribute and it now says data-src.

Releases

No releases published

Packages

No packages published