If you have some longs posts or a list of loyal readers who love to comment a lot on your blog, then it may create a small problem to other visitors, who would wish to come quickly to the top of the blog, after reading a post and it's comments. This is especially a bigger problem in mobile devices.
So why not give them a short cut. To do this, simply add a "Go to Top" arrow button to your blog, which keeps on sliding as the readers read the post, and whenever clicked by him/her, it will escort them to the top region of the blog smoothly [See it in action here: Demo].
Step #1
Log in to Blogger
Step #2
Go to Template section and click on Edit HTML
Now, find this code in your template
Step #3
Finally, Go to Layout and click on Add a Gadget (anywhere in the template) and select HTML/JavaScript type. And add this code in to it:
You can use other images too, by replacing the blue part of the code in step #2. Try any of these most commonly used images:
Credits: Paulund
So why not give them a short cut. To do this, simply add a "Go to Top" arrow button to your blog, which keeps on sliding as the readers read the post, and whenever clicked by him/her, it will escort them to the top region of the blog smoothly [See it in action here: Demo].
Step #1
Log in to Blogger
Step #2
Go to Template section and click on Edit HTML
Now, find this code in your template
</head>And immediately above it, add this code:
<!-- scroll to top smooth jquery starts -->Add the code highlighted in RED, only if you DO NOT already have a jQuery library in your template.
<style type='text/css'>
.scrollToTop{
width:100px;
height:100px;
padding:10px;
text-align:center;
background: whiteSmoke;
font-weight: bold;
color: #444;
text-decoration: none;
position:fixed;
bottom:20px;
right:15px;
display:none;
background: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRq8JqN0WGHrWGhOYlUYjOSn8q1K1QFtXxz0ruNpgFwyDJy9s4k2T-tT7RwdL9Y9XoNsGjYjXUmuK6ddEsk_LLCkOhij1VOX7pGE82j-vcxKeaB0GrAXtaim69oRtagrCUjtQ5GU3P1qw/s1600/scroll_back-to-top_1.png') no-repeat 0px 20px;
z-index: 150;
}
.scrollToTop:hover{
text-decoration:none;
}
</style>
<script type='text/javascript'>
$(document).ready(function(){
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
});
</script>
<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'/>
<!-- scroll to top smooth jquery stops -->
Step #3
Finally, Go to Layout and click on Add a Gadget (anywhere in the template) and select HTML/JavaScript type. And add this code in to it:
<a href="#" class="scrollToTop"></a>
You can use other images too, by replacing the blue part of the code in step #2. Try any of these most commonly used images:
62 comments
Write commentsGreat widget! Thanks for sharing!
ReplyHey, my button is gone and it was there yesterday. What is wrong? My blog where the button is missing: http://howtoearnmoneyonline-snam.blogspot.com/
ReplyIts not a coding problem, actually, the image is hosted at Gigaimage, and i think there's some server problem at Gigaimage, so the images are not loading from them......you can host the image anywhere else and use the same code !
Replythankyou for this page
ReplyWelcome guys !
ReplySai
I am in love with your blog. You just rocked me with tonnes of tips and tricks. I just added you to my follow list.
ReplyThis tricked worked for me. But I want a Back to Top button just like yours. Tell me how to get it
Regards,
Learn how to increase your Computer Speed
haha I got one just like yours by stealing the code from your source file. Credits goes to you.
ReplyTo see the result visit,
Learn how to increase your computer speed
Regards,
MOHD___
Hi! I would like to thank you for all your help, not just here but throughout your site.
ReplyOne question, if I wanted to add one to take me to the bottom of the page, how would I change the code?
Take Care,
Peter
Hi Peter,
Replythanks for your kind comment...
to link the bottom of the page simply make this change in the above code:
change
href="#"
to
href="#footer"
that's it !
Regards
Sai
Hi Sai! That was quick. You're certainly on the ball with your answers! You are to be commended again for your great work! I'll amend the one I'm working on.
ReplyTake Care,
Peter
Hi "Brilliant".
ReplyYou are doing a wonderful job here.
Thanks,
Selvaraj
Hello Selvaraj !
ReplyThanks for the encouraging comment...
You are always welcome here !
Regards
Sai
I have a question. How do you make your back to top button grow on mouse over?
ReplyHi A WoW Addict,
ReplyACtually that's a simple combination of 2 images of different sizes, which change themselves on mouse hover,
You'll better understand that through this post:
http://bloggerstop.net/2009/01/create-html-button-for-your-blog.html
Thanks! The button is working perfectly.
ReplyThis tutorial is very useful. But what codes do I need to add if I also want a "Go To Bottom" button? A "Go To Bottom" on the top-right side and a "Go To Top" on the bottom-right side of my blog's page. I'm gonna have to follow your blog... :))
ReplyHi...
ReplyIn the code above, change this:
bottom:5px;right:5pxto something like:
top:25px;right:5pxRegards
Sai
HOW U CHANGED UR OLDER POST ICON...
Reply?
can u plz tell me how to show html codes in blogger posts the easy way please
Replyjayarajyadav
Thank you for your " Uncomplicated code " you have made my life much easier today ! :) Wishing you much success in all of your life endeavors . Have a great summer !
ReplyWelcome Mia and thanks for your good wishes !
ReplyYou are always welcome here :)
Hi Divya...u r doing a gud job! I'm new in blogging, learning alot from ur tips n tricks...thanks yaar! ;)
ReplyThis is great, I have put both go down and back to top button, but so far they are both pointing up. I think i need to find to same type image one pointing down the other up.
Replycan you please tell me how to have the one like yours in this blog. The one that grow when u move the cursor on it.
I am still making my new blog
I have just added an animated Go Down and Back to Top button. at my blog http://sportsnews247.blogspot.com. I am not working on blog tips but feel free to ask.
ReplyThanks Divya.
.wow..owesome idea..
Reply.excuse me for copy it to my page...
. :). :). :). :). :)
perfectly, is working good, my i can get any trik author???????? like ads pop up menu ;))
ReplyCouldn't get you ramlan...you want to know how a pop-up menu is added?
ReplyWHooaa... it worked ? hehe.. just wonder if we can alter the coding of the top button to make go to old posting.. http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif
Replythanks a lot. Great tip.
Replysee at my blog.
hiii, hackrishna here....
ReplyWell Sorry 2 say that the footer trick isn't working !
I hav done everythin as uu said...but........
Pls Help Yaar.....
Thank uu 4 Spreading all dose Knowledge, but pls dnt 4get 2 find a solution 4 me.
Do not use gigaimage to host your images, rather use tinypic.com
Replyand the widget will start working.
hi, this Button is very nice and useful for all, but i want "Go to Bottom" button in my blog (animalszooguru.blogspot.com). Please provide me the code.
ReplyThanks.
In this tutorial I have used
Replyhref="#"
where the target (#) takes you to the top of the page, so instead of that make an anchor yourself something like #bottom
and then link a floating image to it. For this image, position should be a few pixels from the top instead of bottom.
To know more about anchors, read this tutorial, and everything will be clear to you:
http://bloggerstop.net/2009/01/how-to-link-different-parts-of-same-web.html
Regards
This is the part of the code, that fixes the button on screen:
Replystyle="display:scroll;position:fixed;bottom:5px;right:5px;"
so you can see that display is scroll
position is fixed
now, simply change bottom:5px
to
top: 25px; (or any other value)
and also change right:5px;
to
left:5px;
and then change the url of the image.
okay, in that case
Replychange
position: fixed;
to this:
position: absolute;
Well I couldn't get your question completely, but presently it is not showing up in your blog, because the code you are using is not positioned correctly, use this code instead:
Reply<a style="display:fixed;position:absolute;top:5px;left:5px;" title="Welcome to Tommy's Club Penguin Cheats!"><img src="http://i35.tinypic.com/okv2v4.jpg"/></a>
and to add another image(at right side), use this code:
<a style="display:fixed;position:absolute;top:5px;right:5px;" title="Welcome to Tommy's Club Penguin Cheats!"><img src="http://NEW_IMAGE_ADDRESS.jpg"/></a>
In the a tag, simply put the href, like this:
Reply<a href="http://TARGET_URL_ADDRESS.com" style="display:fixed;position:absolute;top:5px;left:5px;" title="Welcome to Tommy's Club Penguin Cheats!"><img src="http://i35.tinypic.com/okv2v4.jpg"/></a>
:D
ReplyTHANKS
help,
Replyworking on ie but not firefox.
http://chihaw.blogspot.com/
Hi there,
ReplyI have checked your blog in IE, firefox and opera. It is working perfectly in all three browsers.
huh? weird..
Replymaybe something's wrong with my browser.
thanks.
great job!. It works perfectly!.
ReplyYou can check it on my blog:
thundaxsoftware.blogspot.com
thanks!
Thanks for the button to the top! Woks perfectly.
ReplyThank you
Replyjust what my blog's needed :)
;) nice share
Replyhey Divya..i want ur bloger back top Button its cool Button.please give me..it cord..it big help me..thanks..;)
Replyhow to make back to rop like this blog???
Replythank you.
ReplyBefore i was using a long and complex code for getting back to top button. Now i had replaced it with this small code present in this post. Thanks a lot.
ReplyAny suggestion to improve my site is most welcomed.
Ashish
http://discoverdreamland.blogspot.com
Hi, thank you so much for the code. I was wondering if you can tell me what changes did you do in your code for "Back To Top" icon popup like that?
ReplyT
I like it
ReplyTk'y
Thanks buddy its widgets, permit me to share with your friends - with you as a reference source
Replygreeting familiar
It doesn't work.. The arrow is there, but you can't push it - nothing happens.
ReplyThe scroll too fast,,
Replyi want slow sroll, can you help me ???
Thanks ..using it
ReplyComments are moderated on this blog
Allowed HTML tags: <b>, <i> and <a>
Comment Like This! and Optimize your blog EmoticonEmoticon