dina's storylineʕ•ᴥ•ʔ: Memasang Tampilan Persentase Scroll

#FANFIksi Refresh Author Stuff buddies

Memasang Tampilan Persentase Scroll



Blogger >> Template >> Edit HTML
copy below 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;
}
 Tempat pemanggilan
Pasang kode ini diatas <body>
<div id='scroll'/>
Javascript
Untuk javascriptnya, pasang kode javascript berikut diatas </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>
and paste above
*/]]></b:skin>
's code.

After that, you put jquery,
how to put jquery?
copy below code
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'/>
and put above
 </head>
if that already in your blog dont put...

Note : coba dulu gausah pake jquery..jika nggak work,baru pake jquery..
SAVE! Done
creds-( tbdn )

Tidak ada komentar: