Monday 4 February 2013

How to add 'Back to top of page' icon to blogger


While going through some blog designs, I came across a really helpful and nice feature: an icon link to the top of the page which floats in the bottom right-hand corner. As a blog reader, I found this feature to be really useful as it enabled me to jump back to the top of the page after reading a long article or browsing through many posts on the home page. Take a look at the bottom right hand corner of this blog for an example of this in action.


This customization is surprisingly easy to install.

 You can simply add the below given code required into an HTML/JavaScript widget in your blog's layout or, if you use a Classic Blogger template, add this code directly into your template code.

So in this post, I'll explain how to add an icon link to the top of your blog with an example image and code for you to use this right away.
How this works
The icon is styled to appear in the bottom right-hand corner of the page (no matter what screen resolution a visitor uses to access your blog), and can be linked to target the top of the page using the "#" symbol.
The icon link used in this blog is small and unobtrusive; to help new visitors understand how this can be used, I added title text to the image so the "Back to Top" prompt will appear when the visitor hovers their mouse over the link.
The code used to add a "Top of Page" icon link is constructed as follows (I have forced line breaks for clarity):
<a href="#"> <-- This link targets the top of the page
<img src="url-of-image" <-- The URL of your icon
alt="alternative text" <-- Alt text for accessibility
style="display: none; <-- This allows the image to scroll
position: fixed;<-- This fixes the image in place
bottom: 1px; <-- Makes the image appear 5px from the bottom
right: 1%;" /></a> <-- Makes the image appear that distance from the right
How to install the "Top of Page" Icon Link
To use an icon link like the one used here at Blogger Buster, simply copy all of the code below and paste this into an HTML/JavaScript widget in your layout:
<!—techpro365 Scroll to top widget Start--><script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'></script><script type='text/javascript'>$(function(){$(window).scroll(function(){if($(this).scrollTop()!=0){$("#noop-top").fadeIn()}else{$("#noop-top").fadeOut()}});$("#noop-top").click(function(){$("body,html").animate({scrollTop:0},800);return false})});</script>
<a id='noop-top' style='display: none; position: fixed; bottom: 1px; right:1%; cursor:pointer;font:12px arial;'><img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh29LJHHFs0eg5WEjd2N5hyXSa8AUcUTk-JmdajSgPdVE-cujRDELPr61wHvrGu5_lez4JNH82f35zI3J7MYnO4Xmy1lHlGGPJkxEBW7jikb23nXfpwg-MNs4PjU_xC5vsJ2fVWMHo9CDE/s1600/noops-scroll+up.png '  href=’#’  title=’Back to top’ alt='Scroll to top widget @techpro365.blogspot.in ' width="67px" height="67px"/></a><!—techpro365 Scroll to top widget End-->

If you use a Classic Blogger template (with no drag and drop widgets), you can paste this code into your blog's HTML code, somewhere between the <body> and </body> tags instead.
Customizing the Icon Link
If you would prefer to use a different image than the one used here, simply replace the URL of the image with the URL of your preferred image instead.
You can also reposition the icon to suit your design needs. For example, if you wanted the icon to be flush with the bottom right corner (no space), change the code explained above to read this instead:
position: fixed;
bottom: 0px;
right: 0px;

To position the icon further away from the right or bottom sides, simply increase the pixel value to reflect this distance.


Some Examples of "Top of Page" Icon Links

You needn't be restricted to using an arrow for your top of page link! All you have to do is to change the img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh29LJHHFs0eg5WEjd2N5hyXSa8AUcUTk-JmdajSgPdVE-cujRDELPr61wHvrGu5_lez4JNH82f35zI3J7MYnO4Xmy1lHlGGPJkxEBW7jikb23nXfpwg-MNs4PjU_xC5vsJ2fVWMHo9CDE/s1600/noops-scroll+up.png ' underlined code with the image url of the specific image you wish to use. Some of the codes and images are provided here.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBA0VyaJSK0Jzaa1YEGw6u-uJhLlTmL3QVZ2HIDjLwPwxJRbgf_VsiPioq8HeKtStBJ56QRxzfxYIFf0_219IEJLTHUdVSH0Mc2_gAUpLdz7cpKLFza6GOAXHzUgxT7Ja67xwHVG8ED4CT/s1600/noops-Arrow-Up.png 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN9MkGjCrAHh2dW9b7-CLcCAJdyAMG03Pzxv0kHYP0PV_AzS8yld46DqKvRcHDRoxWaJyNyJ09Hb6kuRVMgO61ifbV6ph_PmydpXz-l9CS5a1W_1be6_9uaAxsHa2u6LPIjAtHmCMKGCgR/s1600/noops-Arrow_Up+%25281%2529.png 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv9PFKCOApn4v1tXw4MCD3EpvTo08x0o4HusbU9SzhmiWi6GVi9mevjDuAz8bLNbIIMabQv8rEbbaMvXdQ4SQARLV4UTWbHFm0bxBLNHd67qVSzjvjUzUyOW6ypXh-zS13ZG1mVVCZC3rm/s1600/noops-jquery-scroll-to-top-prestashop-module.png 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimIe-k7XUGe4IPsTT2gYSdb3Q7LnUGpkpufj0iYulcowq0BBn1YMUU4i7QwTkrlbqxvwRkSeOTCf7AOLVMigIy-miRXEqDboR1ZwTieYnPpKOWel80fMIG7A9jc9lTxBHDUuQzaYU-Vxmk/s1600/noops-navigation-up-button_blue.png 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9Xjb8dGxLsmjsr2injuQyzKrztQqizvMa_3h8uEYRAU6ALqs7UYnH2wraDmXYBVI3J3sugGxPVFk7EjFw7_nYQYSEDpBeaeLga8ZqeLF-ncw_bq8rU2GaLn6HvkzlQvhRElWOiTKAGSHz/s1600/noops-scroll+up.png 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7mfJcqCOwlHEKEeA5offpTw1dZFT8l_kw_xCIonIj6nZ1EbiPZRo8gjhXK9eDz6I-SM2mjmegrNS8BlFlANXz9r0lw3gK6iPs89licPoJMImTkbwE-YJA_mo2GpRhu2g2lRDP10sRejKg/s1600/noops-up.png 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSkQDaFdoCbJReNnnZjAyD9yucaRUmY-VkWNmPToNPX62NBSfZn5BxUvYUDFA2TOIFUUf5-WXJU7CP6zAWwctaMOjhTVj3MLLLBFaCjkj8F4nIS2eVVNtwy3Y2VLjG7kGJeraQvbf-o52W/s1600/noops-uplevel_no_text.png 

Do you like this post? Please link back to this article by copying one of the codes below.

URL: HTML link code: BB link code:

About Author:

Raja Sekhar is the founder of this blog. He has been blogging since 2010 and is an active contributor of many blogs.

4 comments :

  1. Been looking all over the Web this morning for a widget like this - this one is by far the most simplistic and serves the purpose perfectly. Thanks!

    ReplyDelete
    Replies
    1. Thank you Brown for your regards.Keep visiting.

      Delete
  2. Thanks for that one! it just the best. i hope to got to assits me more my blog. i want to make the head look like yours.. i have been on interent and later got this and i hope you will help me with that. You can just contact me or email me alade6440@gmail.com

    ReplyDelete
    Replies
    1. Hey! thank you for visiting the page and for your regards. If you have any further queries you can contact me through the "Contact Us" page.

      Delete

Related Posts Plugin for WordPress, Blogger...