Nah bagi sobat yang ingin menambahkan tombol Back to top bada templete blog nya, sobat bisa simak langkah-langkah nya berikut ini
Menambah Tombol Back to top di Blog
1. Login ke akun blogger sobat2. Pilih menu Templete > Edit HTML
3. Masukkan kode di bawah ini diatas kode </head>, tekan CTRL+F untuk pencarian cepat. Namun jika di templete blog sobat sudah ada kode ini sobat bisa skip ke langkah selanjutnya
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'/>
4. Kemudian sobat pindah ke menu Tata Letak > Tambahkan Gedget/Add Gedget pilih HTML/JavaScript lalu copy dan pasti kode berikut ini di widget HTML/JavaScript
<style>
.mbw-back-to-top {
position: fixed;
bottom: 2em;
right: 10px;
text-decoration: none;
padding: 1em;
display: none;
cursor:pointer;
}
</style>
<img class="mbw-back-to-top" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-auWUQmxQDSwP1HZM52vLLd1sD91IVpHfsIEaUNFaz_rq7RhI6UHTA2CxMwndxhgfHftsIYNViSTpo5jE-NC0C4Twi7OhVL6SykgUosDBO2mRq3gEF9mndma__OqMeJn7IX4xybRGdoU/s1600/back-to-top11.png" />
<script type="text/javascript">
/*****mybloggersworld.com***/
jQuery(document).ready(function() {
var offset = 220;
var duration = 500;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.mbw-back-to-top').fadeIn(duration);
} else { //www.mybloggersworld.com
jQuery('.mbw-back-to-top').fadeOut(duration);
}
});
jQuery('.mbw-back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;
})
});
</script>
.mbw-back-to-top {
position: fixed;
bottom: 2em;
right: 10px;
text-decoration: none;
padding: 1em;
display: none;
cursor:pointer;
}
</style>
<img class="mbw-back-to-top" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-auWUQmxQDSwP1HZM52vLLd1sD91IVpHfsIEaUNFaz_rq7RhI6UHTA2CxMwndxhgfHftsIYNViSTpo5jE-NC0C4Twi7OhVL6SykgUosDBO2mRq3gEF9mndma__OqMeJn7IX4xybRGdoU/s1600/back-to-top11.png" />
<script type="text/javascript">
/*****mybloggersworld.com***/
jQuery(document).ready(function() {
var offset = 220;
var duration = 500;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.mbw-back-to-top').fadeIn(duration);
} else { //www.mybloggersworld.com
jQuery('.mbw-back-to-top').fadeOut(duration);
}
});
jQuery('.mbw-back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;
})
});
</script>
5. Lalu klik simpan dan selesai!
Tambahan untuk membuat tombol Back to top dengan efek bounce
Apa itu Efek Bounce? Efek bounce adalah efek memantul dan untuk demo nya bisa di lihat di blog ini. Dan caranya cukup tambahkan kan kode berikut ini masih diatas kode </head><script type='text/javascript'>
$(function() { $(window).scroll(function() { if($(this).scrollTop()>100) { $('#BounceToTop').slideDown(200); } else { $('#BounceToTop').slideUp(300); } });
$('#BounceToTop').click(function() { $('body,html').animate({scrollTop:0},800) .animate({scrollTop:25},200) .animate({scrollTop:0},150) .animate({scrollTop:10},100) .animate({scrollTop:0},50); }); });
</script>
$(function() { $(window).scroll(function() { if($(this).scrollTop()>100) { $('#BounceToTop').slideDown(200); } else { $('#BounceToTop').slideUp(300); } });
$('#BounceToTop').click(function() { $('body,html').animate({scrollTop:0},800) .animate({scrollTop:25},200) .animate({scrollTop:0},150) .animate({scrollTop:10},100) .animate({scrollTop:0},50); }); });
</script>
Dan ganti kode di widget HTML/JavaScript tadi dengan kode di bawah ini
<style type='text/css' scoped='scoped'>
#BounceToTop{position:fixed; bottom:0px; right:3px; cursor:pointer;display:none}
</style>
<div id='BounceToTop'><img alt='Back to top' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpjFK00SKlzQH2BLNefU5OMkElLGXuUCvhQIAMmEaliL2qTGkO1ozwvfJTQajBUWCGA6T51NhyphenhyphenMSpe4xhyphenhyphen4oXDoLj4sPwLTZvENPK9F_29ekDjyYvJJFBZ8s8hOWUImmSFJWTXMI43uQQ/s1600/back+to+top+button.png'/></div>
#BounceToTop{position:fixed; bottom:0px; right:3px; cursor:pointer;display:none}
</style>
<div id='BounceToTop'><img alt='Back to top' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpjFK00SKlzQH2BLNefU5OMkElLGXuUCvhQIAMmEaliL2qTGkO1ozwvfJTQajBUWCGA6T51NhyphenhyphenMSpe4xhyphenhyphen4oXDoLj4sPwLTZvENPK9F_29ekDjyYvJJFBZ8s8hOWUImmSFJWTXMI43uQQ/s1600/back+to+top+button.png'/></div>
Tulisan yang berwarna biru adalah gambar tombol Back to top, sobat bisa gunakan gambar sobat sendiri sesuai dengan warna templete blog sobat Dan saya juga memberikan beberapa contoh gambar Back to top yang bisa sobat gunakan
Beberapa contoh gambar untuk tombol Back to top
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlBMCIq6A9DkxRPeoBGYz_VfBI9ZVU0Pi7flHsZRJ6nbRN16TIH6cwXFi1nJ_R_jzsZfUXYcoM0EfxD9R1KyTItkUNzKtJ496D5Xjnr_Y9hO5geXSIFtk089xQymqubdiubVVIjsErE6k/s1600/back-to-top1.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2S0zj2Vuwghya2F2ZKNvzIr5josUQL1zshvV67NEgQiOH-0kLvLIagxAp48Gi9ORTAPdoo7Kk0zJnkhwnmSAcHPGJyf7UfeqHGWall-poqxRAgk1qHifUmwc-qVhUitM9LorZPaN_D4Y/s1600/back-to-top2.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkBkgDFBcbabe9qUthMPIfFzW_AFllzlb9iOxCHqnk8mWtzovByJaKTO6SVmu_ROmYtBLBMmXpe_cg0AvLvALsS14oFVJgiUKq5ft3MatlubKykiKc20hE_C8GMlL0FCHsk9UYLhY7WYI/s1600/back-to-top3.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR4GKTzmTmckz3N8c-qabRHbaESJIIqy4usIj9UZA3gznsLUIExHmo_vehpvZzuHrYAOu_fc5hTy7FMgYK52os8S7o8u4wPUabhgSnKGB0HTaiS0xjv8gtz83sqfTmxlc74JJI7NwG2Tw/s1600/back-to-top4.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcWCw4zQzuGQu3ZSVKz3CiM7ZnL7ESwAMbOibij4Tefxcu45DQxuYw2K5XJ7jlm5xzL1lssWS3rV5wliiXRN_N4v7uTsq291bBcEy2LIXoqFiQ2g-qVWBBeg5TCbMRaKvbMhX6dSyq6cY/s1600/back-to-top5.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2KTPFoJB-9sjtDSLXhuFDL-l3sIKMkXG8zNQur0G36srB_NzlT2hehc1aDwDSn4M9mmlgPV-jKEpcWEndIHSFhL0WciP15eJkpeF0XiWC_71wZ2lU2rGOpzmB3eenQKauEvRietTfsd8/s1600/back-to-top6.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_4vvbEWAWDU5vDTxTbVJ06Q3g6v89og9Lfiw5JvpkBs4q-WEA5oR65xws5c6vWTjg6io80AEoj9GszrRI9JuUcQ7ASK4KFfSDUQPskSiYjI0_pSimfeGidPJrHKYM3hLhFV5ZN38QxD8/s1600/back-to-top7.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFnyLg8QXwEYXrbtWS5gPY10KSfCig40pUspZR07BqcT0hAGzgjzK645dXWGiNygA5rAZfQgMX30jr_kEDRSf9a_lh636svMSAKYPuNUqw4SL7p7FS-D-QPCXOUOxiJ9OTAIYJAPfxlMw/s1600/back-to-top8.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyvertkNPsHshOt9181UGaHNTzEjRyIOPARsCcSjmAlnPBl755Ae6C0LY-R9YHQzHqdhyJ6x9XEIZcCuPprsaSxEokKlsz8idtfodkgh6t9jl0_9ZDkw7gOcm94vwRU1fAXfMzpAarKCw/s1600/back-to-top9.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz43b3gRQTHtTLMlFp3qqlbXyIEa00clEw5vPZxuQ-eaZbZ2Lvte4tF_XrVKhKu70IXcg6BBNbcHaBXJMSi94sDsDXhLqIQPT8ONYXEu_cwXWDdAWCTM1RMA23_91RF6Z9LLgCs9yKqDc/s1600/back-to-top10.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-auWUQmxQDSwP1HZM52vLLd1sD91IVpHfsIEaUNFaz_rq7RhI6UHTA2CxMwndxhgfHftsIYNViSTpo5jE-NC0C4Twi7OhVL6SykgUosDBO2mRq3gEF9mndma__OqMeJn7IX4xybRGdoU/s1600/back-to-top11.png
Oke sekian dari saya, semoga bermanfaat
Keep Enjoy!