Skip to main content

Adding Floating Social Media Buttons and Customising it

You might have seen floating share buttons in many sites. We also have one in our site, so we thought to share that with our viewers. It is very easy to include and in this post we will look at how to add them and customise them to your requirements.

There are several advantages in adding social media buttons to your web pages, as it will help the readers to easily share the pages, also it helps the publishers to reach wider audience. There are so many different social media platforms available, but it is impossible to include all of them to your site. Firstly you need to select which ones to include. Then you can modify the following code to add them. In our site we have included the following,
  1. Facebook like button.
  2. Stumbleupon button.
  3. Reddit button.
  4. Facebook share button.
  5. Twitter button.

Now we will look at how to add Facebook like button to it. Firstly you need to generate the code "Facebook Like" button. Then copy the "IFRAME" code and replace the phrase in red colour (<!-- Copy the "Facebook Like" button "IFRAME" code here-->) in the following code. Then copy that code into a "HTML/Java Script" gadget in Blogger (please use similar widget in other platforms).
#socialshare {
border: 1px solid black; 
padding:0 0 2px 0;
#socialshare .sharebuttons {
margin:5px 5px 0 5px;}

<div id='socialshare' title="Share This With Your Friends">
<div style="text-align: center">Pls share
<div style="text-align: center">this page

<div class='sharebuttons' id='facebook' style='margin: 0 0 0 10px;'>
<!-- Copy the "Facebook Like" button "IFRAME" code here-->

<div class='sharebuttons' id='reddit' style='margin: 0 0 0 10px;'>
<script type="text/javascript" src="">

<div class='sharebuttons' id='su' style='margin: 0 0 0 10px;'>
<script src="">

<div class='sharebuttons' id='pintrest' style='margin: 0 0 0 13px;'>
<a href='javascript:void(run_pinmarklet1())'>
<img src="" style='margin:0; padding:0; border:none;'/>
<script type='text/javascript'>
function run_pinmarklet1() {
  var e=document.createElement('script');
  e.setAttribute('charset','UTF-8');        e.setAttribute('src',''+Math.random()*99999999);

<div class='sharebuttons' id='fb'>
<a name="fb_share" type="box_count" href="">Share</a><script src="" type="text/javascript">

<div class='sharebuttons' id='rt'><a href="" class="twitter-share-button" data-count="vertical" >
</a><script src='' type="text/javascript">

<div style="text-align: center">
<a href="">
Get This

Customising the floating share buttons:

This code by default floats on the left side of your page; to make it float on the right side of it, change the 7th line as follows:

To change the horizontal location of this widget change the 6th line appropriately. Only change the value of it (i.e -650) to a value suitable to your site.

If you would like to add more buttons or need help in modifying the code, please specify them in your comments.

Update: Modified the code to include Pinterest button and all the buttons were aligned to centre.

You may also interested in reading: