Our social:

Add Smooth Scrolling Back To Top Button On Your Blog

Add Smooth Scrolling Back To Top Button On Your Blog



Adding jQuery Code (Optional)

1. If you have not already placed jQuery in your template then follow this steps or jump directly to next section of this tutorial.
2. Go to Template > Edit Html
3. Then Search for <head> by pressing CTRL + F

4. Paste below code just after the <head> Tag

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script


How To Add jQuery Back To Top Button

1. Go to Blogger > Layout
2. Now click on Add Gadget and select Html/Javascript 
3. Then Paste below code into it.


<style>
.mbw-back-to-top {
    position: fixed;
    bottom: 2em;
    right: 10px;
    text-decoration: none;
    padding: 1em;
    display: none;
    cursor:pointer;
}
</style>
<img class="mbw-back-to-top" src="IMAGE URL" />
<script type="text/javascript">
/*****mybloggersworld.com***/
jQuery(document).ready(function() {
    var offset = 220;
    var duration = 500;
    jQuery(window).scroll(function() {
        if (jQuery(this).scrollTop() > offset) {
            jQuery('.mbw-back-to-top').fadeIn(duration);
        } else { //www.mybloggersworld.com
            jQuery('.mbw-back-to-top').fadeOut(duration);
        }
    }); 
  
    jQuery('.mbw-back-to-top').click(function(event) {
        event.preventDefault();
        jQuery('html, body').animate({scrollTop: 0}, duration);
        return false;
    })
});
</script>

4. Now replace IMAGE URL with any image from below list or any of your choice. 



Author : Mybloggersworld


0 comments:

Post a Comment