In today’s post , i will explain that how you can add/show percentage
value to scrollbar in blogger blog. actually it is not important for
your blog, but this is for those who want to give unique effect to
scroll-bar in their blog. it may be helpful for your readers to check
that how much they have scrolled down or up or how much content left to
be read.
Also Read:-
Blogger trickz Blogger Widget Menu Bar Css Css3
Check the preview below and follow the steps, if you want to add this right to your blog.
Preview :
How to add percentage value to scrollbar in blogger?
1. Go to blogger –> Tempalte –> Edit HTML
2. CTRL + F to find this : ]]></b:skin>
3. Copy and paste below code just above this : ]]></b:skin>
#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; }
4. Next search for </head>
5. Copy and paste below code just after </head>
<div id='scroll'></div>
Make sure you pasted the code after </head> and before <body> like this :
</head>
<div id='scroll'></div>
<body>
6. Now, again search for </body>
7. Copy and paste below code just above </body>
<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>
8. Save template.
Get Free UpDates ?
If yes, Then enter your email below to get
more such great articles in your inbox
Powered By HAmza Gujjar Get Free !
0 comments:
Post a Comment