Scroll Bar With Percentages For Blogger
Hi guys today i am going to post an widget for adding percentage for scrollbar which can help your visitors to know how long the page or post is .
Remember Save your template before doing other steps.(This Step Is Optional)
6. Now search for </head>
7. And now add the following code below </head>
9. And above it paste the following code.
And DoNe.
Install It Into Blogger
1. Log Into Blogger Dashboard
2. Navigate To Template
3. Click On Edit HTML
4. Search For ]]></b:skin>
5. Paste the following code below it
#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;
}
6. Now search for </head>
7. And now add the following code below </head>
<div id='scroll'></div>8. Now search for </body>
9. And above it paste the following code.
<script type='text/javascript'>10. Save Template
//<![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>
And DoNe.
Nice One {M+C} Always your widgets are awesome
ReplyDelete