Wednesday, 9 April 2014

How to Add Animated Back to Top Button in Blogger

I suppose you might have seen stylish and animated Back to Top button in several websites and blogs. In this tutorial I'll show you how to implement one in your Blogger Blog. It will look alike as in my blog. You can change the code and make it stylish according to the theme of your blog.

Step 1
Go to Blogger Dashboard. Select your blog and click on TemplateEdit HTML.

Click on Edit HTML

Step 2
Now, press Ctrl + F and search for </head> tag.  

Add the following code before it.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
.back-top {
    background: #FFFFFF; // background color of Back to Top Button
    color: #fff;
    font: bold 24px/100% &quot;Times New Roman&quot;, Times, serif;
    width: 30px;
    height: 30px;
    padding-top: 4px;
    margin-bottom: 40px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    zoom: 1;
    border-radius: 10em;
    box-shadow: 0 2px 0 rgba(0,0,0,.1);
<script type="text/javascript">
jQuery(document).ready(function() {
    var offset = 220;
    var duration = 500;  // duration of animation
    jQuery(window).scroll(function() {
        if (jQuery(this).scrollTop() > offset) {
        } else {
    jQuery('.back-top').click(function(event) {
        jQuery('html, body').animate({scrollTop: 0}, duration);
        return false;

Step 3
Now find </body> tag. 

Copy the following code and paste before it.

<a class='back-top' href='#header'>⇡</a> // symbol indicating Back to Top

Step 4
Now Save Template.  

That's all..! You can change the colour, width, height and symbol of Back to Top button for getting better results. If you've any doubts regarding this please don't hesitate to ask it below..!