Temukan kode ini:
</body>
Salin kode di bawah ini dan letakkan di atasnya:
<style type='text/css'>
#top {
display:block;
cursor:pointer;
position:fixed !important;
position:absolute;
bottom:-50px;
right:10px;
z-index:999;
}
#bottom {
display:block;
cursor:pointer;
position:fixed !important;
position:absolute;
top:50px;
right:10px;
z-index:999;
}
#top:focus, #bottom:focus {
outline:none;
}
</style>
<script type='text/javascript'>
//<![CDATA[
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$("#top").stop().animate({
bottom: "50",
right: "10"
}, {
duration: 1000,
queue: false
})
} else {
$("#top").stop().animate({
bottom: "-50",
right: "10"
}, {
duration: 1000,
queue: false
})
};
if ($(this).scrollTop() > 100) {
$("#bottom").stop().animate({
top: "-50",
right: "10"
}, {
duration: 1000,
queue: false
})
} else {
$("#bottom").stop().animate({
top: "50",
right: "10"
}, {
duration: 1000,
queue: false
})
}
});
$("#top").removeAttr('href').on("click", function () {
$("html, body").animate({
scrollTop: 0
}, "slow");
return false
});
$("#bottom").removeAttr('href').on("click", function () {
$("html, body").animate({
scrollTop: $('#footer').offset().top
}, 970);
return false
})
});
//]]>
</script>
<a href='#top' id='top'>
<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTmU883jalMVCkjvPodopFsLKJVs9ntfd8UgGgFWxlUoOEZb81uDX1QkhVP1bPZRLjPSQXY6_VqO8Sq9_owPNZaELRZedrN8JqwiMcwGb8HdvS0m4KBJexL53yBlmQvi1k4Jejn8DoJxb3/h120/dhfscrolltop.png' title='Atas!' />
</a>
<a href='#footer' id='bottom'>
<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicVqth_hfo64Uv2dwxNpJ44N-NXJKutwtoP5TxjUf45PzTKCd4IPx5Ok2f2ni5bhzKrSiZWl6m6px3FNhgZMxf8c1CEi3SxfppjAW6TtAyVBROW72w22HsHOuVJAHQnwwRobSPV1IJgxF9/s1600/dhfscroll.png' title='Bawah!' />
</a>
<div id='footer' />
Pastikan bahwa pada template anda sudah di lengkapi dengan kode (JQuery)
0 Komentar: