8000 GitHub - jameshibbard/lazyYT: A jQuery plugin to lazy load those dang Youtube iframe videos.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jameshibbard/lazyYT

 
 

Repository files navigation

lazyYT.js

Description

This is a JavaScript plugin to lazy load Youtube videos. On the initial load, the div will be replaced by a preview img of the video. On click of the image, the preview img will be replaced by the autoplaying iframe Youtube video.

Intro

To read more information on the plugin and access a demo, view the intro post on newmediacampaigns.com.

Demo

View the demo.

Setup

<div class="lazyYT" data-youtube-id="_oEA18Y8gM0" data-ratio="16:9">loading...</div>
  1. Include the lazyYT JS and CSS files.
  2. Add a div where you want the video to be located. Add the id of the Youtube video to the data attribute youtube-id.
  3. Either add the video width and height to data-width and data-height, or add an ascpent ratio like 16:9 to data-ratio.
  4. Any optional parameters you wanted passed to the iframe url should be added to data-parameters.
  5. Get it started with LazyYT.init(".js-lazyYT");

License

MIT

About

A jQuery plugin to lazy load those dang Youtube iframe videos.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 56.3%
  • CSS 43.7%
0