This is a jQuery plugin to lazy load Youtube videos. On the initial load, the div
will be appended by a preview img
of the video. On click of the image, the preview img
will be replaced by the autoplaying iframe
Youtube video.
To read more information on the plugin and access a demo, view the intro post on newmediacampaigns.com.
<div class="lazyYT" data-youtube-id="_oEA18Y8gM0" data-ratio="16:9">loading...</div>
div
where you want the video to be located. Add the id of the Youtube video to the data attribute youtube-id
.data-width
and data-height
, or add an ascpent ratio like 16:9
to data-ratio
, none are required.data-parameters
.$('.lazyYT').lazyYT();
(CC) Creative Commons