Designed by Veethemes.com

How to add custom Thumbnail/Image for Youtube Video in Blogger Post

Customise your youtube video in blogger post and use custom thumbnail for your youtube video.
How to add custom Thumnail/Image for Youtube Video in Blogger Post
Youtube Video
View Demo
Today , We discuss about 'How to customise your Youtube Video for blogger post'. In this post we use custom thumbnail for embed youtube video and if you click on thumbnail then show the video & play.

This code work using simple jquery :

$(document).ready(function(){
  $("#play").click(function(){
    $("#remove").hide();
    $("#add").show();
  });
});

and design youtube iframe using css code with different classes :
  • .youtubeBorder
  • .youtube
  • .play
Click on play - Circle thumb then show the youtube video and play video. [Also use Autoplay function use for youtube video.]

How to add custom Thumnail/Image for Youtube Video in Blogger Post :

  • Go To Blogger Dashboard >Template >Edit HTML.
  • Now Search the following code: </head>
  • copy and paste the below code , before </head> tag 
CSS Code :
<style type="text/css">

.youtubeBorder{background:none repeat scroll 0 0 #FFFFFF;border:1px solid #E0E0E0;border-radius:2px;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);margin:10px 0 20px;padding:4px}
.youtubeBorder p.post-video{margin:0 !important}
.youtube{background-color:#000;max-width:100%;overflow:hidden;position:relative;cursor:hand;cursor:pointer;height:330px;width:100%}.youtube .thumb{bottom:0;display:block;left:0;margin:auto;max-width:100%;position:absolute;right:0;top:0;width:100%;height:auto;opacity:.8;filter:alpha(opacity=80)}
.youtube .play{filter:alpha(opacity=90);opacity:.9;height:77px;left:50%;margin-left:-38px;margin-top:-38px;position:absolute;top:50%;width:77px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE0AAABNCAYAAADjCemwAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABgtJREFUeNrtXE1IJEcUFuYgHhZZAzOQwKLsaeY4MuCisLNkMUYM+TtmQwgYQSEg8RCIBAMBSYIQPCgEEiEYISZIgrhzCRLYg+BBMiiDGCHGH4xGETH4O85M+huql7Knuqe7urq7ercePAZnuqtefXZVvfe911VToyRUUqdpVNMmTROaJjVt0bRN0/uapsl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fLy8hgLdH19/ct+gYZxshLSVAnEDanTSwW8mJo8oFFG/z0xMfFxkFOUKoG4UXSDKpw0aiRYIZMIg9zmMA8ODv6gWAjPlBVaARfye7SC+2cF58gzygAacY6LYFq7urre9go0jNciiG+q8M9YsaYovkxk5txL55jl6FKxaKKCBmLxZshsywYa7UfNzc19IZJxwXgteLZkBauBOjDjDSgJkBU0et0dHR3tF2EnxmtsH7iwWA+UaKZRQGe8AbUUsoOmy87OzhO3zjHGa2wXuJDf22jQytkmUoF4Q1CEEhbQRDjHGC9jA8pT2aqnog+sInkiKpj2CzTssNgB0+n06zx2YrysEI+65tl60hD4Dw0N9bix08mTFuo1DSFXJpP5UsQu6mRNC+XuSZjgX0QG9052z9D5aYYivXQQflpoIoKLi4tDsBFesb1OIgLpY09MxVwu97PXPJuT2FNqlgMMx8DAwPt+0ENOWA4p+TRMRT8TL075NKmYW3j1y8vLP8bj8Vf9pLudMrfS5Aj29/eXgsrE8+QIAs1GgeaZnp7+LKgUHm82KpC8J6ZiNpv9we+pKCrv6XuGHUUxPT09j2QoTeDNsPtWy6EZuDc1NfWp7CWldms5PK0a0qbixdLS0veyFL6IqhryrD5td3d3IaiSAz/q01QlJEclpKq55ay5VdXdHNXdEPUeAaeoN1Y4Rb0bxSHqLTxOUe97cop6s5hT1DvsboFTpyVwTlV1LofzzUGdAMPpjqizhtxEDjXqVCuuWFWdn8Yp6qQ+F6LOhHQh6vRRF6LOuRUg6kTl50n+B4KhcERZo7nRAAAAAElFTkSuQmCC") no-repeat}
.play:hover {filter:alpha(opacity=100);opacity:1;}
</style>

  • After adding css code and now search for </body> tag.
  • Add below code before </body> tag.
HTML CODE:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("#play").click(function(){
    $("#remove").hide();
    $("#add").show();
  });
});
</script>

How Embed code use in Blogger Post:

Create a New Post and Where you want to place this code , Just copy the below code paste in Blogger Post HTML Section.

<div  class='youtube' data-id='RVEnhNzBlgM'><iframe id="add" style="display:none" width="100%" height="330" src="//www.youtube.com/embed/RVEnhNzBlgM?rel=0" frameborder="0" allowfullscreen></iframe><div id="remove"><a href="https://www.youtube.com/watch?v=RVEnhNzBlgM"><img class='thumb' src="http://i.ytimg.com/vi/RVEnhNzBlgM/hqdefault.jpg"/></a><div class='play' id="play"></div></div></div>

Customise this embed code:

  • For eg. Your youtube link is - https://www.youtube.com/watch?v=RVEnhNzBlgM and after https://www.youtube.com/watch?v= green background code is youtube link ID.
          This code replace every green background code, like above embed youtube video code.
  • If you want to autoplay your Youtube video then add ?autoplay=1 
          eg.  https://www.youtube.com/watch?v=RVEnhNzBlgM?autoplay=1
  • Use your custom thumbnail for your youtube video - <img class='thumb' src=",,,,.jpg"/>
I hope you enjoy this article and please share on social media.
If any query then comment below.

0 comments:

Post a Comment