All Projects β†’ the-muda-organization β†’ youtube-lazyload

the-muda-organization / youtube-lazyload

Licence: MIT license
LazyLoad Embed YouTube Player - simple and lightweight plugin - pure JavaScript

Programming Languages

HTML
75241 projects

Projects that are alternatives of or similar to youtube-lazyload

lazysimon
Minimal effort 350 byte JavaScript library to lazy load all <img> on your website
Stars: ✭ 18 (-21.74%)
Mutual labels:  lazyload, javascript-library
Progressively
A JavaScript library to load images progressively πŸŒ‡
Stars: ✭ 691 (+2904.35%)
Mutual labels:  lazyload, javascript-library
amirajs
Amirajs is Lightweight (~0.4kb compressed) JS Library for DOM Manipulation
Stars: ✭ 12 (-47.83%)
Mutual labels:  javascript-library
kolorwheel.js
🌈 Color palette generator JavaScript library
Stars: ✭ 37 (+60.87%)
Mutual labels:  javascript-library
indexeddb-orm
Indexed DB ORM
Stars: ✭ 53 (+130.43%)
Mutual labels:  javascript-library
ionic4-sidemenu-auth
Building a Basic Ionic 4 Login Flow with Angular Router & Side Menu UI
Stars: ✭ 34 (+47.83%)
Mutual labels:  javascript-library
stackml-js
Machine Learning platform in-browser for creators
Stars: ✭ 34 (+47.83%)
Mutual labels:  javascript-library
DevHelpBox
we are creating this community so that other developers can get benefits of it.
Stars: ✭ 35 (+52.17%)
Mutual labels:  javascript-library
lazyload-vue
Vue Plugin for vanilla-lazyload
Stars: ✭ 29 (+26.09%)
Mutual labels:  lazyload
cms-fe-angular8
A Content Management System with Angular8, UI use Ant-Design(ng-zorro-antd)
Stars: ✭ 65 (+182.61%)
Mutual labels:  lazyload
awesome-app-js
This document list all the javascript libs used at Soixante circuits. They are compatible with Webpack and run in the browser and / or node only.
Stars: ✭ 16 (-30.43%)
Mutual labels:  javascript-library
jvm.js
A Java VM bytecode library written in ES6 for Node.js
Stars: ✭ 33 (+43.48%)
Mutual labels:  javascript-library
DummyJSON
DummyJSON provides different types of REST Endpoints filled with JSON data which you can use in developing the frontend with your favorite framework and library without worrying about writing a backend.
Stars: ✭ 213 (+826.09%)
Mutual labels:  javascript-library
zsh-lazyenv
Environments for lazy load commands and speed up start up time of zsh
Stars: ✭ 16 (-30.43%)
Mutual labels:  lazyload
Awesome-Javascript
A Curated list of Awesome JavaScript Resources
Stars: ✭ 116 (+404.35%)
Mutual labels:  javascript-library
tung
A javascript library for rendering html
Stars: ✭ 29 (+26.09%)
Mutual labels:  javascript-library
fancy-textfill
Fast implementation for resizing text to fill its container.
Stars: ✭ 17 (-26.09%)
Mutual labels:  javascript-library
thenewboston-js
JavaScript library for thenewboston.
Stars: ✭ 39 (+69.57%)
Mutual labels:  javascript-library
contentajs-graphql
GraphQL.js helpers for Contenta JS
Stars: ✭ 13 (-43.48%)
Mutual labels:  javascript-library
pinyin4js
A opensource javascript library for converting chinese to pinyin。welcome Star : P
Stars: ✭ 153 (+565.22%)
Mutual labels:  javascript-library

Youtube LazyLoad

LazyLoad Embed Youtube Player - simple and lightweight plugin - pure JavaScript


Status

GitHub Version License

Github Star Github Fork

CSS gzip size JS gzip size


View Preview



Table of contents


Quick Start

Several options are available:

  • Download the latest release.
  • Clone the repo: git clone https://github.com/the-muda-organization/youtube-lazyload.git
  • Install with Composer: composer require the-muda-organization/youtube-lazyload

What's included

Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You'll see something like this:

There are no dependencies. No jQuery or other plugins required. See below for Installation Guide and How to Use

yt-lazyload/
 β”‚
 └─ dist/
    β”‚
    β”œβ”€β”€ css/
    β”‚   β”œβ”€β”€ yt-lazyload.css
    β”‚   └── yt-lazyload.min.css
    β”‚
    └── js/
        β”œβ”€β”€ yt-lazyload.js
        └── yt-lazyload.min.js

Bugs and feature requests

Have a bug or a feature request? Before opening a new issue search for existing and closed issues. If your problem or idea is not addressed yet, open a new issue.


Installation

  1. Download and copy files to your project
  2. Open yt-lazyload.js
  3. Change settings:
    • settings_thumb_base_url to custom URL where your thumbnails are located.
  4. Minify JavaScript and place it in yt-lazyload.min.js.
  5. Add CSS and JavaScript to your project:
    <link href="https://example.com/yt-lazyload/4.x.x/css/yt-lazyload.min.css" rel="stylesheet">
    <script src="https://example.com/yt-lazyload/4.x.x/js/yt-lazyload.min.js"></script>

NOTE: Because of small file sizes I recommend adding CSS & JS inline!

    <style>...</style>
    <script>...</script>

How to Use

  1. Get Youtube ID of your movie, example: d4AmYBhGBfM
  2. Add the folowing code to embed a video:
<div class="yt-lazyload" data-id="d4AmYBhGBfM" data-thumb="" data-logo="3"></div>
  1. Name your thumbnail using Youtube ID d4AmYBhGBfM.jpg - to use other file types change settings in JavaScript
  2. Place your thumbnail in a folder set in JavaScript

Features

Attribute Explanation
class="yt-lazyload" Main container.

You can add additional style like border, box-shadow etc. or Bootstrap classes like img-thumbnail, shadow etc.
data-id="d4AmYBhGBfM" Youtube video ID
data-thumb="" If you need to add more thumbnails you can choose which one is displayed. It is usefull for quality specific thumbs (SD, 720p, 1080p) or in case of multiple thumbs random one can be selected.

Name your files d4AmYBhGBfM.jpg and add custom suffix.

For 3 thumbnails make d4AmYBhGBfM--1.jpg, d4AmYBhGBfM--2.jpg and d4AmYBhGBfM--3.jpg.

To show thumbnail 2 use data-thumb="--2" and so on.

You can randomize numbers using <?php echo mt_rand(1,3);?>.

Leave empty if you have only 1 thumbnail.
data-logo="3" Youtube logo color. You can customize it in CSS.

0 = none - logo will not be added by JavaScript,
1 = black,
2 = color-black,
3 = white,
4 = color-white (v4.0.0+).

CSS Classes

CSS class Explanation
.yt-lazyload main container
.yt-lazyload::before pseudo-element used to maintain container ratio and set background-color
.yt-lazyload-wrap container and its content added via javascript
.yt-lazyload-content container for play button, logo and thumbnail as background-image
.yt-lazyload-playbtn play button (black)
.yt-lazyload-playbtn:hover play button on hover (red)
.yt-lazyload-logo Youtube logo
.yt-lazyload-logo:hover Youtube logo on hover
.yt-lazyload[data-logo="X"] .yt-lazyload-logo Youtube logo color based on data attribute
.yt-lazyload iframe Youtube embeded iframe after click

FAQ

  • Can I use Youtube domain to get thumbnails?
    • I am not sure if it will work in all cases, but you can try. You need to adjust JavaScript.
    • Change settings_thumb_base_url = 'https://img.youtube.com/vi/';
    • Change this_content.style.setProperty('--yt-lazyload-img','url("' + settings_thumb_base_url + this_data_id + '/maxresdefault.jpg")');
  • Can I use Youtube lazyload with other frameworks like Bootstrap?
    • Yes you can! There should be no conflict with other frameworks.
  • Can I embed video players other than Youtube?
  • Does it work on mobile devices?

Versioning

Youtube LazyLoad will be maintained under the Semantic Versioning guidelines as much as possible. Releases will be numbered with the following format: <major>.<minor>.<patch>


Changelog

For last releases see detailed CHANGELOG.


Team


Code of conduct

We will behave ourselves if you behave yourselves. For more details see our CODE_OF_CONDUCT.md.


Copyright and license

Code and documentation copyright 2017-2020 The MUDA Organization.

Code released under the MIT License.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].