In the past, we have already shown you a way through which you can customize your Scrollbar using Web toolkit. Recently, one of our users asked us how to add percentage value to a Scrollbar in Blogger? It basically shows you the percentage of a page while scrolling. It might turn out to be extremely useful for your visitors to find out how much page they have scrolled, or how much content is left to be read. In this article, we will show you How to Add Percentage Value to a Scrollbar in Bloggers.
Note: You can check out the demo of this widget Here (Tip: Make sure you scroll up or down the page to see the percentage along the scrollbar).
The First thing you need to do is to login into your Google account making sure that your blogs are hosted on that particular account. Now go to Blogger Dashboard and select the blog in which you would like to add Percentage Value to a Scrollbar. Go to Template >> Edit HTML and search for the ]]></b:skin> tag. Once you have found the ]]></b:skin> tag successfully, just above it paste the following CSS code.
#scroll {
display: none;
position: fixed;
top: 0;
right: 20px;
z-index: 500;
padding: 3px 8px;
background-color: #2187e7;
color: #fff;
border-radius: 3px;
}
#scroll:after {
content: ” ”;
position: absolute;
top: 50%;
right: -8px;
height: 0;
width: 0;
margin-top: -4px;
border: 4px solid transparent;
border-left-color: #2187e7;
}
After adding the CSS coding, search for the ending </head> tag and right after it paste the following code. (Tip: Make sure you paste the code between the ending </head> and opening <body> head tag.
<div id='scroll'></div>
Lastly, search for the ending </body> tag and just above it paste the following JavaScript code. This is the code which will ensure that your scrollbar shows the accurate percentage upon scrolling up or down the page. Once everything is done, save the template by pressing “Save Template” Button available on the top right corner of your screen.
<script type='text/javascript'>
/*<![CDATA[*/
var scrollTimer = null;
$(window).scroll(function() {
var viewportHeight = $(this).height(),
scrollbarHeight = viewportHeight / $(document).height() * viewportHeight,
progress = $(this).scrollTop() / ($(document).height() - viewportHeight),
distance = progress * (viewportHeight - scrollbarHeight) + scrollbarHeight / 2 - $('#scroll').height() / 2;
$('#scroll')
.css('top', distance)
.text(' (' + Math.round(progress * 100) + '%)')
.fadeIn(100);
if (scrollTimer !== null) {
clearTimeout(scrollTimer);
}
scrollTimer = setTimeout(function() {
$('#scroll').fadeOut();
}, 1500);
});
/*]]>*/
</script>
Congratulations: You have successfully added percentage value to a scroll bar in bloggers. Now go and check our blog to see the widget in action.
We hope this tutorial have helped to learn How to Add Percentage Value to a Scrollbar in Bloggers. Let us know if you have any suggestions by commenting them below.
DISCLAIMER
Gistfans do not claim ownership of any of the Songs and Videos that we upload and any copyright infringement complaints will be executed immediately! It is our policy to honor all take-down requests! Email Us via Gistfansofficials@gmail.com
CONTENT REMOVAL
If you believe that this page has violated your copyrighted/protected material(s), please kindly Contact Us for immediate removal, or mail us at Gistfansofficials@gmail.com stating the content name/URL of the page. Thanks.
To upload your music on Gistfans and get massive download, contact us now:
Whatsapp: 08095459350
Email: Gistfansofficials@gmail.com
| Article Name | How to Add Percentage Value to a Scrollbar in Bloggers. |
| Description |
|
| Author Name | Head Admin |
| Published On | 3/22/2018 |
| Post Category |
blogging tips
|



After dropping your comment, keep calm, it may take minutes before it appears after moderation.
Your comment(s) are appreciated.
You want to get notified when i reply your comment? Kindly tick the Notify Me box.