jQuery Plugin For lazy Loading Youtube Videos - youCover

File Size: 109 KB
Views Total: 7893
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Plugin For lazy Loading Youtube Videos - youCover

youCover is a Youtube lazy loader plugin with jQuery that replaces the default Youtube iframe player with its cover image and loads actual YouTube videos ONLY when needed (click the thumbnail). Easy to integrate with fancybox to create a fancy Youtube Video Lightbox/Gallery.

The plugin also has the ability to detect the current screen width and auto disable Autoplay on mobile devices.

See also:

How to use it:

1. Include jQuery JavaScript library and the jQuery youCover plugin's files on the web page.

<link rel="stylesheet" href="youCover.css">
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="youCover.js"></script>

2. Embed a Youtube video into the webpage using the following data attributes:

  • data-youcover: required
  • data-width: width of the Youtube player 
  • data-height: height of the Youtube player 
  • data-src: video source
  • data-wrapperclass: custom CSS classes
  • data-id: Video ID (instead of data-src)
  • data-allowfullscreen: allow fullscreen
<div data-youcover 
     data-wrapperclass='youCover custom'
     <!-- data-id='3BhkeY974Rg' -->

3. To create a Youtube Video Lightbox/Gallery using fancybox plugin:

<link rel="stylesheet" href="jquery.fancybox.min.css">
<script src="jquery.fancybox.min.js"></script>
<div data-youcover data-fancybox data-id='MGgr62ZrfdU' data-rel='galery'></div>
<div data-youcover data-fancybox data-id='ocwnns57cYQ' data-rel='galery'></div>
<div data-youcover data-fancybox data-id='xD7D5ZN1pro' data-rel='galery'></div>



  • Bugfix

About Author:

Author: kiaonline

Website: https://github.com/kiaonline/youCover

This awesome jQuery plugin is developed by kiaonline. For more Advanced Usages, please check the demo page or visit the official website.