How To Add jQuery Lazy Loading YouTube Videos inwards Blogger

YouTube is ane of the most dominating online Video broadcasting website which has simply about flexible options to live on embedded inwards a webpage. Furthermore, in that place are no 2 opinions that YouTube enriches a weblog amongst awesomeness. However, what would scope if nosotros embed twenty unlike kinds of Videos into ane Webpage? It volition sure cut back the page speed in addition to would growth the issue of HTTP requests. Since, every video is hosted inwards an iframe. Therefore, it takes a piece to load. For ane video, it would non accept also long, but for twenty it would sure eat a hell lot of disk infinite addition it volition also decrease the page speed. For the reason, MBL Developers lead maintain developed a robust jQuery plugin for Lazy loading YouTube videos.

Tutorial #3: How To Add jQuery Lazy Loading YouTube Videos inwards Blogger?
Tutorial #4: How To Avoid Useless Widgets That Increases Blog Load Time?

What is Lazy Loading YouTube Video? 

When nosotros lead maintain lots of videos embedded into a unmarried webpage it quite obvious that it would growth the charge time. However, what would scope if nosotros lead maintain a spider web page containing a YouTube Video which volition non live on played until a someone clicks on it. This is a straightforward tip that yous may lead maintain seen on Facebook Videos. In reality, the video is hidden behind an icon in addition to alone appears whenever a visitor clicks on it. We lead maintain added a lazy Loading YouTube Video below thence experience gratis to click on the below icon in addition to run into the magic.

How to Add Lazy Loading YouTube Video inwards Blogger?

Nowadays The Embed code of YouTube looks a like to the following. It is simply an artless iframe that helps inwards embedding. 

<iframe width=”420″ height=”315″ src=”https://www.youtube.com/watch?v=aoJ29q_ClGk?rel=0″ frameborder=”0″ allowfullscreen></iframe>

The outset affair nosotros involve to produce is to add together CSS coding to blogger template. Go to Blogger >> Template >> Edit HTML >> Proceed. Now search for Skin tag in addition to simply inwards a higher house it glue the next chunk of coding. 

/********************************
/////////////////////////////////////////////////////////
//                                                     //
//  //  Designer: Syed Faizan Ali //
//  All rights are Strictly Reserved  //
//                                                     //
/////////////////////////////////////////////////////////
********************************/
a.mbl-youtube-lazy-loading {
  vertical-align:top;
  background:#555;
  width:560px; height:315px;
  background-size:cover;
  text-decoration:none;
  color:#DDD;
  text-align:left;
  text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
  display:inline-block;
}
a.mbl-youtube-lazy-loading:hover {
  text-decoration:none;
  color:#FFF;
}
.mbl-youtube-lazy-loading-div {
  border:2px corporation #000;
  background: url(http://lh4.googleusercontent.com/-QCeB6REIFlE/TuGUlY3N46I/AAAAAAAAAaI/9-urEUtpKcI/s800/youtube-play-button.png) middle centre no-repeat;
  position:absolute;
}
.mbl-youtube-lazy-loading-div:hover {
  background: url(http://lh5.googleusercontent.com/-oBFjswrosz4/TuHqainRc3I/AAAAAAAAAbE/t3rMQuSJdLA/s800/youtube-play-button-hover.png) middle centre no-repeat;
}
.mbl-youtube-lazy-loading-info {
  font-size: 110%;
  font-family:lora;
  padding: 2px 6px;
  background: rgb(0, 0, 0);
  background: rgba(0, 0, 0, 0.5);
}
#mycontent { 
  text-align:center;
  position:relative;
}

After pasting the CSS coding deed ahead in addition to search for </head> tag in addition to simply inwards a higher house it glue the next JavaScript coding. Don’t worry it volition non disturb the charge fourth dimension of your website. Once everything is done Save the template.  

<script src=’http://code.jquery.com/jquery-latest.js’ type=’text/javascript’></script>

Now permit us speed upwards our Page Speed. Once the Lazy loading script is installed its fourth dimension to utilize it. Go to Blogger >> Add New Post >> Select the Edit HTML Tab in addition to simply glue the next coding. Note: This technique also plant on WordPress in addition to other platforms too. 
<div style=”text-align:center;”><a class=”mbl-youtube-lazy-loading” href=”https://www.youtube.com/watch?v=aoJ29q_ClGk” style=”width: 540px;height:315px;” title=”How To Add jQuery Lazy Loading YouTube Videos inwards Blogger”><b>An Introduction To Blogger Post Editor</b></a></div><div id=”mycontent”>Powered By <a href=”omelto.com”>omelto.com</a></div>
<script src=’https://mybloggerlab.googlecode.com/files/lazyYT.js’ type=’text/javascript’></script>

From the Above Coding supersede the next according to your needs.
  •  https://www.youtube.com/watch?v=aoJ29q_ClGk with your YouTube Video URL.
  •  540px to growth the width.
  •  315px to growth the height.
All Done: Now afterwards customizing the inwards a higher house coding, striking the Publish button. That is all. This technique is fleck novel thence if anyone faces whatever põrnikas then, produce non hesitate to exit your comment below.

From The Editor’s Desk:

It almost took to a greater extent than than 2 months to issue simply about other Article of this series. The argue behind that was the difficult locomote our Team has done to prepare this JavaScript. However, presently nosotros volition complete this serious on a high. What are your thoughts virtually this Lazy Loading jQuery Script? Feel gratis to portion your views. Take tending till then, Peace, Blessings in addition to Happy loading. 


Sumber http://www.mybloggerlab.com