Blogger Ever

How to display a fixed sharing bar when a user scroll to post in Blogger using jQuery plugin?

jQuery plugin Waypoint is one of the most productive plugin a web-designer can use to create impressive callback function when scroll to a specific element.
How to display a fixed sharing bar when a user scroll to post in Blogger using jQuery plugin?

Scrolling events can be customized by jQuery .scroll() function, but believe me Waypoint is a jQuery plugin that gives you way more better functionality to execute function when scroll to specific element. Well in short I am going to add a sharing bar which will not be displayed on home page as well as on post pages until your scroll to post. Have a look how it is possible to make it.
  • Go to Template > Edit HTML
  • Make sure you have jQuery added.
  • Find
<body>
Paste the following code just below it
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div class="share-buttons">
    <div class="facebook">
        <div class="fb-share-button" expr:data-href="data:post.url" data-type="button_count"></div>
    </div>
    <div class="twitter">
<a class="twitter-share-button" expr:data-url="data:post.url" href="https://twitter.com/share">Tweet</a>
    </div>
    <div class='google'>
        <div class="g-plusone" expr:data-href="data:post.url"></div>
    </div>
</div>
</b:if>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/platform.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Find </head> and paste the following code just above it.
<script src='http://imakewebthings.com/jquery-waypoints/waypoints.js' type='text/javascript'></script>
<script>
$(function () {
    $('.blog-posts').waypoint(function (direction) {
        if (direction === "down") {
            $('.share-buttons').fadeIn();
        } else if (direction === 'up') {
            $('.share-buttons').fadeOut();
        }
    });
});
</script>
Find //]]></b:skin> and paste the following code just above it.
.share-buttons{
  position:fixed;
  display:none;
z-index:10;
  left:0;
  top:0;
  width:100%;
  background:#eee;
  border-bottom:3px solid #ddd;
}
.share-buttons>div{
  min-width:200px;
  padding:25px 0 25px 30px;
  float:left;
  border-right:1px solid #ddd;
}
Save your template and see the effect. If something goes wrong comment below. 
Blogger

2013-2016 Copyright Blogger E\ver . Coded, managed and founded by Mohammad Hamza (@hamzadhamiya) . Hosted on Blogger and fonts used are Raleway and Open Sans.