In some blogger templates we get inbuilt back to top feature but this feature is not always available in all blogger templates and therefore we need to install it manually. There are many back to top widgets that are available on different sites but not all of them are smooth.
The best thing about this button is that it appears only when the user scrolls down the page and disappears as he scrolls up.
Tested in> Firefox , Safari , Chrome , Opera , IE
How to Add Back To Top Button Widget for Blogger
- Go to Blogger >> Layout>>Add Gaget
- Choose “HTML/JavaScript” Widget.
- In the HTML/JavaScript widget paste code of the search box widget and save the widget.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" >
var scrolltotop={
//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
controlHTML: '<img src="IMAGE LINK" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport) //if control is positioned using JavaScript
this.$control.css({opacity:0}) //hide control immediately after clicking it
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
dest=jQuery('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
},
keepfixed:function(){
var $window=jQuery(window)
var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
this.$control.css({left:controlx+'px', top:controly+'px'})
},
togglecontrol:function(){
var scrolltop=jQuery(window).scrollTop()
if (!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
if (this.state.shouldvisible && !this.state.isvisible){
this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
this.state.isvisible=true
}
else if (this.state.shouldvisible==false && this.state.isvisible){
this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
this.state.isvisible=false
}
},
init:function(){
jQuery(document).ready(function($){
var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
.attr({title:'Scroll Back to Top'})
.click(function(){mainobj.scrollup(); return false})
.appendTo('body')
if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
mainobj.togglecontrol()
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
mainobj.scrollup()
return false
})
$(window).bind('scroll resize', function(e){
mainobj.togglecontrol()
})
})
}
}
scrolltotop.init()
</script>
Customizations:
- Replace IMAGE LINK with the URL of the button you have selected.
STYLE.1
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQs4B2_aWovypSd-7S4pXTC8Ic29mWDc2k7cYfCFCSp9rbPPUNKbjGyWWcT0pbS3uUs-yoKt8ED54jAFg9iCcZRQvTZavldYoixhX6UNVKbYzjE56bk20RCzSt1kkrFTUTNSWtyN9Z_P1J/s1600/circle5.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGNvJX3kaVCAzyv5MjQ9_V13gx2fjdY0ByUkBhGnKSVlQxqjEyhP7cS2VQ9Z3oDW11Z96IhTNxOxYgZ_LgZp5QMhG3REGla7iIB4EGR1c3c3r1-flS5bfyqWabmxv53g_1yEBVBnL_oD0J/s1600/go+to+top+button.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-SPQ1iGDyz40wvf-1wuMjLK3Mr6RK_4cr0O0_aJSxbhodkL6mhNFIpAAHiqGAb-AEU3aLAQ4dg5Por_1NqrZF0VjgCe5jtjhcZVc9ePu3-Nwv3hQruCSE-zXR3hDHQ0RNleEtYY-aaJlI/s1600/go+to+top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSnoRw4B20I4w71qVlF2X71uoZkOQDixCChPdsYweggV6Qd6r6L_RCqoRWisp_6MURwMAiOjbU9ZWssNDGqV_Dp1j5vIvBDaFRBlBiSWJMd5ZN1BJLV10ZUDXGpHJrQc9PYIQ1-KQBtsSR/s1600/square2.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht70aOhL4y-1uTF-Iak4l20Jd7m996E_iKD948X1WxokimGTvrNH-h4e8UZwjvbJybYVL3oGiftqCTGhRnu41F00qhCeXYzqncUSkfY2CdqsA-N9DlI4ZjTATCQW9LUktO7tcIo2YlguOi/s1600/up+arrow+image.png
STYLE.6
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPG2s7PYGZqiNPuxif8Db2iLKuyRsMw5M-9WpVbqippwjrxjxjk8j5txBz99_8onPiFRvZlD2gF389GBuT4ybH7Ylb5wrWhnx2l-2weN9DkjxYkcQoDBqaK83MJI1VpT6kGXwiyjz-AOpQ/s1600/1uparrow.pngm
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjxSQ4UT8rHeHeGWIML9YSh1OkQwx9i3XoNWKqrE_A92heOJh-wVcpCimKRzGpGULVSfRCBXbB0AWApXJd7JH5uE1FMqjWLtCY5wMt9SVu8JKLSib109MsIrvwiZTcLBLePDxVVS3cj6xJ/s1600/2%5B4%5D.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Q7AuqwqwEpMJLyJxJbC_dbwVaGO67D6vt3mvzgJmX3_6rEnvmhBP24XNcsjOm_mFvPBSDIGlmxLtJgH_27PYVi3CaiM4-WfnkT-UwH8bP8YDS80gRApK9hfChvsI5psq89Kqr9QgNTFN/s1600/9%5B4%5D.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0L2Xn_3jVE0Xe0lDRTondoNe9Z1iCXjxMwBdl-tblSVv5SVmMM7kH8g9iJXNlwObU_bC6VxPGecXuJLuDUufooCfSTsez88qgAa4WuU6tM_Vs2Vypjdj_lJb5qBrDBOhyobhbe9iICPkU/s1600/arrow7.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNV1W6O9ls7aIVzSvRD4R4Pceyq1lZXbNNCF8lRvqj7PYHQG38TSGPq99U5N_hzJ7orcHxlaQkyiC8bBYN_fBti7jzvm_o6qb7oeUpSXMV1j56Ok7YPpo8XJeVytMr0qxbUJ_FsMZdKwpO/s1600/back-to-top-small-1%5B4%5D.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifcwgPo9pVMH6VoiRyCVZrzZcWayTKzPWj4sNZdQitn6HxMqeP6VuS35dxwoZH_WeWRQqUBiQkkwdbMns4HWsH4GnxQH0L0f0O92jdI82sPUQRiPQOj-I05Gd_uxQC1uZBwH1FxSH-k6ve/s1600/Back-to-top.png
If you have any doubt in your mind, you may ask via comments or contact form.
DON'T FORGET TO "SUBSCRIBE" or"LIKE" FOR FURTHER UPDATES












Post a Comment