Cara Memasang Back to Top di Blog Blogspot
Cara Membuat, Menampilkan, atau Memasang Tombol, Ikon, atau Menu "Back to Top" di Blog Blogspot
CB baru saja memasang tombol "Back to Top" di Blog ini. Anda bisa lihat di kanan bawah layar monitor Anda. Cara memasang Back to Top seperti ini sangat mudah.
Tombol "Back to Top" memudahkan user atau pengunjung kembali ke bagian atas blog, dalam satu klik, tanpa harus men-scroll mousenya atau "mengusap-usap" jarinya di "touch pad" atau layar SmartPhone-nya.
CB merasa butuh memasang tombol "kembali ke atas" ini karena kadang/sering harus membuka postingan dengan komentar yang banyak, sehingga "turun banget" dan harus bersusah-payah "scroll" ke bagian atas.
Nah, dengan adanya tombol "Back to Top" ini, CB tinggl "klik" dan tampilan bagian atas blog akan tersaji secara otomatis.
Atau seperti ini:
Kalau belum ada, lakukan langkah ini:
- Template > Edit HTML
- Cari (CTRL+F) kode </head>
- COPY salah satu kode tersebut dan PASTE di atas kode </head> tadi.
- Save!
2. Klik "Layout" (Tata Letak)
3. Klik "Add Gadget" di Sidebar
4. Pilih "Javascript/HTML"
5. Copy dan Paste kode berikut ini:
Kode yang berwarna merah adalah image "Back to Top". Anda bisa menggantinya dengan gambar lain sesuai dengan selera Anda, juga sesuai dengan background blog Anda.
1. Layout
2. Add Gadget
3. HLML/Javascript
4. COPAS kode berikut ini dan Save!
Itu dia cara membuat atau memasang tombol Back to Top di blog blogspot untuk kenyamanan dan kemudahan pengunjung, juga kemudahan kita sendiri sebagai admin blognya. Good Luck and Happy Blogging!
Sumber
CB baru saja memasang tombol "Back to Top" di Blog ini. Anda bisa lihat di kanan bawah layar monitor Anda. Cara memasang Back to Top seperti ini sangat mudah.
Tombol "Back to Top" memudahkan user atau pengunjung kembali ke bagian atas blog, dalam satu klik, tanpa harus men-scroll mousenya atau "mengusap-usap" jarinya di "touch pad" atau layar SmartPhone-nya.
CB merasa butuh memasang tombol "kembali ke atas" ini karena kadang/sering harus membuka postingan dengan komentar yang banyak, sehingga "turun banget" dan harus bersusah-payah "scroll" ke bagian atas.
Nah, dengan adanya tombol "Back to Top" ini, CB tinggl "klik" dan tampilan bagian atas blog akan tersaji secara otomatis.
Cara Memasang Back to Top
1. Pastikan di template blog Anda sudah ada kode jquery, yaitu kode seperti ini:<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'/>
Atau seperti ini:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
Kalau belum ada, lakukan langkah ini:
- Template > Edit HTML
- Cari (CTRL+F) kode </head>
- COPY salah satu kode tersebut dan PASTE di atas kode </head> tadi.
- Save!
2. Klik "Layout" (Tata Letak)
3. Klik "Add Gadget" di Sidebar
4. Pilih "Javascript/HTML"
5. Copy dan Paste kode berikut ini:
<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/AVvXsEhM5Go5vbf47gKPEkxlK4-Rh2P5tpEajDukvbzyIX6UVG3_RdNGDj6wjF4UdgrnRQq4Yq-QhGVKkaBAbc0fR-cH9jxD_Jo8SMPADIXgT40SMIujGaiOuisUElhdcrcfadQ1WwgOW2IYuIw/s1600/back+to+top.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/AVvXsEhM5Go5vbf47gKPEkxlK4-Rh2P5tpEajDukvbzyIX6UVG3_RdNGDj6wjF4UdgrnRQq4Yq-QhGVKkaBAbc0fR-cH9jxD_Jo8SMPADIXgT40SMIujGaiOuisUElhdcrcfadQ1WwgOW2IYuIw/s1600/back+to+top.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>
Kode yang berwarna merah adalah image "Back to Top". Anda bisa menggantinya dengan gambar lain sesuai dengan selera Anda, juga sesuai dengan background blog Anda.
Koleksi Gambar Tombol Back to Top untuk Blog
Ini pilihan gambar/tombol "Back to Top" dan URL-nya yang bisa Anda gunakan. Copas link URL-nya ke bagian yang berwarna merah dalam kode di atas tadi.https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxVq_4_XrPbVkqRvbdgUxtuYGqUu_YJXDuGCHH3t19ps9Ls34tR1hYZQfw0olpJ-wa6T-u1q68wBHiiVLFZtGnGKRAeIBnZ9PgCPDYd6kyZZObqXYq69h-CsuuTf-nSUrXRwCbA0w6gHA/s1600/back+to+top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCiLcrXQpBQZluNtHdJYPfBh3kmh6o-Yg9qPG27PbsBi0OW8T9Ys3P_II7nBpca5d4f8c2o9_ayHVd8I5dm9C6e98EmNkFuBOpQGBY_YHHZbT7c52oQLpnOgIeqyPiJk5bUXSbdeLXFy0/s1600/back+to+top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9ZvSqR4hcSyn0UCc2vZZ5oOUrAgZQ8i6x6-d7zxkogmLrFOHV7hrb3Ap6Nzdj8HJ9F5LHh7wM6qUy89sgRIB0gxaROZ_qe9yYvssaFbMVMtWy4yhkDDhGbkuZrACIZ8iSB9PTEcYxgds/s1600/back+to+top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbFI9YTdVfrxD8Z1Yq5hp9vkqDBac2_GYublJbIWB7RNF24ecuD-fOT7sW9te8EOSWnxHyqp123JBuAOcDYmd-xw8w6xS74J7IBtQlChaEjoAutNk2GCI82KoRo0ZPu-GTt6wGyAzm-2k/s1600/back+to+top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzr1tezm8ryKSqmzizKA0UcEKiL0pjLfeUePOkLqgMaaahz0MfimCO1h3x6f-iKFLcB7TkTrI_pZMFXy9BeL0jZfL6RXix-hM2FkMXGzC5BwsWoDqrWvVPeO5Hz6LnCM-qu2Y4d8l60Dw/s1600/back+to+top+button.gif
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF71P-joNv5y9DraGuWjEXoXHdPvnhJMO7ccAwvgTT2AOmsKJiwcsjG7pGjErY8GGt3Ny6dngD-zybCy0Z78mE314PmnxIGnpHKRObhetT7qJ4qc45HSuTiSkjOwMEFuzsh97JAMp40-k/s1600/back+to+top+button.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVIs65lzIQBdvqujofBv3SWjGyxO8v_4yeanypq_5DS2p7-b-YLrto2t_BIeAC_PvqtB0MuZdahuGJcmDbv1k9EMypZA4SAwnbEAFLexnpTrQW-V0gRTjC1l5Nmq5iBPXofuMUFFrq5gw/s1600/back+to+top+button.gif
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6VWcAJWfOfjXRQBkUu9wRerp5TVpLfXWZvfGHQZ256NVEhxY_O4upuA9ODQiwxvIGCu4YCaAp2OIuEe8ID0dJ1zvXo9II8sQA-kJ2hCTGMrjctjDed0aQZNOo0E8pmFDU3TP3-4SzJrY/s1600/back+to+top+button.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM5Go5vbf47gKPEkxlK4-Rh2P5tpEajDukvbzyIX6UVG3_RdNGDj6wjF4UdgrnRQq4Yq-QhGVKkaBAbc0fR-cH9jxD_Jo8SMPADIXgT40SMIujGaiOuisUElhdcrcfadQ1WwgOW2IYuIw/s1600/back+to+top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisadafv730S-598Cue4kkOaaRL1-Wwm_u8HmTUvGn4jnEMiZksb963_JIG7JmrTurLKqwoNQBH3ZczZZgnF-ylfrytUBCzQZUHfD7OUQVPkQW3pNrjU0FozaZUr1ifD0OkF5-KWl6DxZk/s1600/Back-To-Top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAN_5uL1DU-CO8LvaqD9LAMreQiT9knHhzWFoydraHEr3PQ6N7ZMRUXMS8XL0LCv5T72ZIhuaGoGdX2zzuSneBNwaHO1kFDaGcYePfSNl775bL6oy20BAxqfCfVTj8geHECvbKnMGTtEs/s1600/back-to-top-button.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYzAFgEpI2WKp1mmYZ52p8y8hStDL_ruwajK1oG7nVzy9S1gYbJBbDkHwMUr5xRJdn_T8IsFFbwZDE8DfUvsub-H-F_M0kmq3rK3ZEYjlQuCADhy-drhtZh1znCmBrbKt-aBba_5-IuFc/s1600/back-to-top-button.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM2p8OFQ1xpoCmzb2N27Mt42848BQk9x8dA54xYkl3UCzTrzlIO56qkTzspDTibTv93jr5T-e2e9imZWyOAU7hbTy_Ehx9QOrgoCZd11wLeArksTYTQIrfOADziUK3MmgRFnDHCFUz788/s1600/back-to-top-button.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTKXH-K50jUG4k80Ugiza-F-07xLY-GqBM4ls5ybspLoTb77jN5OtlB2cyK_3TzUvuZEuNHpLETAyZlmtcM0mRijQWRG12kYJAdAzyyRXifzTqVpRPLLvb6cXe6Oe-xrmawUt7_zTUGB0/s1600/Back-To-Top.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMXuBjUhpbq4WyAdGuJ6rwbnLnknpEo_mwHdU5IucidHRRFrGd3GcUNjv89TR6eQhSZHniAGuHTKNisBLjOXpisd8G5U5o1FVyEMFrAwp4Maag01wA2z6o6AlDV7jCKC_ZDIUrKX6Bk34/s1600/back_to_top_button.png
Alternatif Cara Memasang Back to Top
Jika cara di atas tidak berhasil, coba lakukan langkah berikut ini.1. Layout
2. Add Gadget
3. HLML/Javascript
4. COPAS kode berikut ini dan Save!
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" >
var scrolltotop={
//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
controlHTML: '<img src="URL Gambar Back To Top" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport) //if control is positioned using JavaScript
this.$control.css({opacity:0}) //hide control immediately after clicking it
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
dest=jQuery('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
},
keepfixed:function(){
var $window=jQuery(window)
var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
this.$control.css({left:controlx+'px', top:controly+'px'})
},
togglecontrol:function(){
var scrolltop=jQuery(window).scrollTop()
if (!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
if (this.state.shouldvisible && !this.state.isvisible){
this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
this.state.isvisible=true
}
else if (this.state.shouldvisible==false && this.state.isvisible){
this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
this.state.isvisible=false
}
},
init:function(){
jQuery(document).ready(function($){
var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
.attr({title:'Scroll Back to Top'})
.click(function(){mainobj.scrollup(); return false})
.appendTo('body')
if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
mainobj.togglecontrol()
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
mainobj.scrollup()
return false
})
$(window).bind('scroll resize', function(e){
mainobj.togglecontrol()
})
})
}
}
scrolltotop.init()
</script>
<script type="text/javascript" >
var scrolltotop={
//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
controlHTML: '<img src="URL Gambar Back To Top" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport) //if control is positioned using JavaScript
this.$control.css({opacity:0}) //hide control immediately after clicking it
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
dest=jQuery('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
},
keepfixed:function(){
var $window=jQuery(window)
var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
this.$control.css({left:controlx+'px', top:controly+'px'})
},
togglecontrol:function(){
var scrolltop=jQuery(window).scrollTop()
if (!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
if (this.state.shouldvisible && !this.state.isvisible){
this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
this.state.isvisible=true
}
else if (this.state.shouldvisible==false && this.state.isvisible){
this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
this.state.isvisible=false
}
},
init:function(){
jQuery(document).ready(function($){
var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
.attr({title:'Scroll Back to Top'})
.click(function(){mainobj.scrollup(); return false})
.appendTo('body')
if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
mainobj.togglecontrol()
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
mainobj.scrollup()
return false
})
$(window).bind('scroll resize', function(e){
mainobj.togglecontrol()
})
})
}
}
scrolltotop.init()
</script>
Itu dia cara membuat atau memasang tombol Back to Top di blog blogspot untuk kenyamanan dan kemudahan pengunjung, juga kemudahan kita sendiri sebagai admin blognya. Good Luck and Happy Blogging!
Sumber
Cara Memasang Back to Top di Blog Blogspot
Reviewed by admin
on
5:05:00 PM
Rating: