Skip to content

Deferred (lazy) loading of YouTube videos, to improve page load time

License

Notifications You must be signed in to change notification settings

teawithfruit/ytdefer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ytdefer

Deferred (lazy) loading of YouTube videos, to improve page speed. Initially an image of the video is displayed, and the actual video is loaded and starts playing when the user clicks on it.

Demo

https://www.groupboard.com/ytdefer.html

Usage

<script src="ytdefer.min.js"></script>

<div style="width:380px;height:214px" class="ytdefer" data-alt="Enter optional img alt text here" data-title="Enter optional img title here" data-src="<youtube video id>"></div>

<script>
window.addEventListener('load', ytdefer_setup);
</script>

About

Deferred (lazy) loading of YouTube videos, to improve page load time

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%