Simple and easy navigation is very helpful for your blog readers. I have experienced lot of websites around the cyber world, which have a navigation structure confused me very badly. If you have lot of contents on your website then you should be ensure a pleasant user/ reader experience. It can be ensured if you consider yourself at the reader place and think what is missing here. In this tutorial, I am sharing a smooth "Back to Top" button for Blogger blogs.This will help your visitors to Go back to Top by a single mouse click with a smooth pleasant reader experience.
This Button will appear on your website when you start scrolling down to page. z-index property is also added as some websites with pop up ads not showing button on top. Thanks to DynamicDrive for such a beautiful script.
This Button will appear on your website when you start scrolling down to page. z-index property is also added as some websites with pop up ads not showing button on top. Thanks to DynamicDrive for such a beautiful script.
Also Read: Create a Float Image to Any Corner of Your Blog or Website
Add Cool Back to Top Button to Blogger
- Sign in to Blogger
- Got to Layout > Add a Gadget > HTML /JavaScript
- Add the following code inside and save.
<style>
div#topcontrol{
position:auto!important; margin-bottom:20px!important; z-index:9999999!important;
}
</style>
<script type="text/javascript" >
/***********************************************
* Scroll To Top Control script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Modified by My Blogging Tricks
* This notice MUST stay intact for legal use
* Visit Project Page at http://www.dynamicdrive.com for full source code
***********************************************/
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="http://4.bp.blogspot.com/-Y4vEn34r_lk/UWQM91hy5wI/AAAAAAAABmE/s8mTDhhdBu8/s1600/6.png" />', //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>
Also Read: New and Flexible Recent Posts Widget With Thumbnail for Blogger
Note: If jQuery Plugin is not already in your Template. Add this by following the simple steps:- Go to Template > Edit HTML
- Press "Ctrl + F" and Find <head>
- Paste the following code below <head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
Some Beautiful Styles for Back To Top Button
Copy one from the links given below and replace with text highlighted RED in the code.
http://2.bp.blogspot.com/-qiT6jQb7Vbc/UWQM7vkElDI/AAAAAAAABls/jnWeKJuaRQ0/s1600/5.png
http://2.bp.blogspot.com/-_2YWPSlgmpk/UWQM7heXH9I/AAAAAAAABlw/SeVM-0u4Phc/s1600/4.png
http://4.bp.blogspot.com/-wt6O7MWczeo/UWQM71x8XSI/AAAAAAAABl0/lKMjYMQQV-0/s1600/3.png
http://4.bp.blogspot.com/-Y4vEn34r_lk/UWQM91hy5wI/AAAAAAAABmE/s8mTDhhdBu8/s1600/6.png
http://2.bp.blogspot.com/-8y8bgO7NGnk/UWQM-PhaGLI/AAAAAAAABmI/rJJel9LTAtE/s1600/btt1.png
http://1.bp.blogspot.com/-LurtoWePXLM/UWQM94hBDhI/AAAAAAAABmM/ipey8BA2i9M/s1600/8.png
http://2.bp.blogspot.com/-oBEDK6qDSx0/UWQNAS_GYJI/AAAAAAAABmc/tzAwM37Z5Wk/s1600/bttp-7.png
Need Further Help
I have enclosed all information in this post, If you want further help, write us below in comments.
Don't forget to say thanks in comments!! Happy Navigation
Get Latest Updates
0 comments:
Post a Comment
We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually us according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden.
Regards:
Zaka Ur Rahman