Add A CSS Animated Share Button on Blogger

I saw this on Paulund, a highly recommended site with a good collection of snippets, i.e. a collection of different codes that develop small utilities, all of these being applicable to web design.

In this tutorial, we will see how we can add a similar share button on Blogger with a really cool hover effect and 4 social media icons with links to share the current page on Facebook, Twitter, Google+ and Pinterest. However, we can replace these social networks later with any other just by changing the links below.

Demo:


Creating A CSS Animated Share Button

Step 1. From your Blogger dashboard > go to "Template" > click on the "Edit HTML" button.

Step 2. Click anywhere inside the code area and press the Ctrl + F keys to open the blogger search box. Type or paste the ]]></b:skin> tag and hit Enter to find it.

Step 3. Just above ]]></b:skin> add this CSS:
.share_button {
width: 300px;
height: 50px;
margin: 10px auto;
}
.share_button ul {
width: 50%;
height: inherit;
float: left;
list-style: none;
margin: 0 !important;
padding: 0 !important;
}
.share_button ul h1 {
margin-top: 9%;
overflow: hidden;
width: 100%;
color: #4889F0;
font-size: 18px;
text-shadow:2px 2px 2px #fff;
}
.share_button ul li {
position: absolute;
height: inherit;
width: 150px;
margin: 0 !important;
padding: 0 !important;
background: #EEEEEE;
-webkit-transition: all 600ms;
-moz-transition: all 600ms;
-o-transition: all 600ms;
-ms-transition: all 600ms;
transition: all 600ms;
text-align: center;
}
.share_button ul li h2 {
display: inline-block;
width: 32%;
height: 40px;
overflow: hidden;
margin-top: 5%;
cursor: pointer;
border: 0 !important;
}
.share_button ul:first-child li:first-child{
text-align: right;
}
.share_button ul:last-child li:first-child{
text-align: left;
}
.share_button ul:first-child li:last-child,
.share_button:hover ul:first-child li:first-child {
-webkit-transform: rotateY(90deg);
-moz-transform: rotateY(90deg);
-o-transform: rotateY(90deg);
-ms-transform: rotateY(90deg);
transform: rotateY(90deg);
}
.share_button ul:last-child li:last-child,
.share_button:hover ul:last-child li:first-child {
-webkit-transform: rotateY(-90deg);
-moz-transform: rotateY(-90deg);
-o-transform: rotateY(-90deg);
-ms-transform: rotateY(-90deg);
transform: rotateY(-90deg);
}
.share_button:hover ul:first-child li:last-child,
.share_button:hover ul:last-child li:last-child {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
transform: rotateY(0deg);
}
Step 5. Now let's go ahead and insert the HTML button in the template. The most common place would be just after <div class='post-footer'> - find the second <div class='post-footer'> and paste the following code just above it:
<div class='share_button'>

<ul>
<li><h1>
Share t
</h1></li>

<li><h2>
<a expr:href='&quot;http://www.facebook.com/sharer.php?u=&quot; + data:post.canonicalUrl + &quot;&amp;t=&quot; + data:post.title ' title='Share on Facebook'><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht8VPqjEZ65n5pzOkd0UmyQxkMlzJPeu19T_9UCP2W2oKDGdPRsM6yXPw53atMg-Pl3Z0zWeForZ-mlNPIoyl6gnQICmNIVQUr4BpSaHWeX3sE2kNoMHCVtkySJm_Yph5N7-8WhQZHWhpm/s1600/Facebook.png"/></a></h2>

<h2><a expr:href='&quot;http://twitter.com/home?status=&quot; + data:post.title + &quot; &quot; + data:post.canonicalUrl ' title='Share on Twitter'><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpwJnE05CQXtxQ0jwjC2_54bdeBxA4C1H4ySFr6e_x8c4otat_RICa8vRp-Rxi6om97tg5ZPTQeUrwOvvwu3d4KIj8ctqBwp_oDiTVcFOELNddJE0s-nSCxJc00xFoNZU3TjPB40s00WaP/s1600/Twitter.png"/></a></h2>
</li>
</ul>
<ul>
<li><h1>his page</h1></li>

<li>
<h2><a expr:href='&quot;https://plus.google.com/share?url=&quot; + data:post.canonicalUrl ' title='Share on Google Plus'><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrxgpBuRrn_w088LZvemWeGe2J8APMUoek65wKx6C-j-uv8GOBGM_EgBEuEl7Kv-sbwd1aBNq5QL-64sD4V81smDPPrZATD_FbsGEr7_H403F-kvum5VEZN70zxr6FKqJ50YErzFkVl0qW/s1600/Google-plus.png"/></a></h2>

<h2>
<a href='javascript:void((function(){var%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;http://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)})());' title='Share on Pinterest'><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg20HMaTa7YunfXysS2PwuZXR-6YcZLYRXL8x7Z_eIDlC8zQEDStIEOswXaMRSO5kij0DE_atFpiQNxn97VYvTr5KtymE1So-X08m2t6jYzeGzWAFUA9yc1aidacGIh6FrJiM-C2B-SK98e/s1600/Pinterest.png"/></a>
</h2>
</li>
</ul>

</div>
Note: if you want to change the icons, replace the URLs in blue.

Step 5. Click on the "Save template" button and we're done! Enjoy ;)

8 comments:

  1. nice sharing :) after I'll try it on my blog, thanks :)

    ReplyDelete
  2. Thank you for the tutorial! :)

    But I'm wondering can I put it in the side bar?

    ReplyDelete
  3. Hello! I totally love this and customized the Icons. I looked of the text you had us put in and I was wondering if there is a way to change the "Share this page" text or change the image of it? Thank you for posting this!

    Emily at Houseandhone.com

    ReplyDelete
  4. thankx a lot buddy, but I would also request you that you also upload videos of your posts

    ReplyDelete
  5. thanks a lot but I have a problem
    I have done it correctly but it does not shows a animated share button instead it shows them in a column in my every post just like an image ( no animation)
    pls help thanks

    ReplyDelete