Back to top artinya ialah tombol shortcut yang disediakan di bilah kanan blog. Tombol back to top ini dapat mempermudah pengunjung atau pembaca blog untuk kembali ke atas halaman tanpa harus menggulirkan layar dengan mouse atau usapan.
Kalau kalian tertarik untuk membuat back to top, ikuti langkah-langkah berikut.
π Pertama, kalian harus login ke blogger
π Kemudian pada dashboard pilih layout (tata letak) selanjutnya klik add a gadget (tambahkan gadget)
π Klik HTML/javascript
π Setelah itu, copy paste kode di bawah ini
<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: 'Paste URL Back To Top Anda Disini" />', //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: 'Paste URL Back To Top Anda Disini" />', //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>
π Kata yang berwarna hijau dapat diganti dengan URL gambar back to top sesuai selera kalian.
Berikut gambar back to top dengan URL-nya.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh30Gc1upDyvvclXovsZMpDGYr_-6VCbsOpsC1eXbOZVs7B0AwR0_gXx-17aQrxZh8FISkBBmTGM2uxTVVV9j_kex16ZX73CQ5GfKU8wdzxWeK44kiSLFMkSIuLTwgCu8Il9Ra7knK6-S8/s1600/back+to+top+4.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj4wcxPlwpPBDEpWdzBjJJaOe_JNclVYh_Iiih3Zr_LbIMH0gynOuaaW8NWNrFH_r2Kna1vBF16yWkaViOP70x-mLc8EqYH0VDzhqN5H_Gi9DsDCclJPO-1fl4bYJaQBeqnreBz1KkOCg/s1600/back+to+top+by+me.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZeadbfNUXFnjHB4vIc55Upbqy3yl_W6LFty_Q6YkASAVT1wOAhadefjNbuZl7lndzT6ysRvyjRXKRJVcoJNXTJZZ8tOGvHhyphenhyphenG0MUUYNqXXqkcF7zZwCq-KIXtzbBqzdNuXooG9dT6c5k/s1600/back+to+top+3.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQmOtHqj7msF84mjG-kHM3Nzpl4_-V8s8OhPLu_Y5UKayJRzlrCntNXysjpNzB-mlN5f0u7geGee1iQorPVEKJ_7KX6Z6fsJOHHIs1K4Gl0hruU9DGNChWlRsiN_Gbdf-LHit9qOt1ufba/s1600/back_to_top_button_pink.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSP2CmDkVoM9HcLTd8yd4sHhkm8LUYUocbKabg1_uV2l4JYGwe6W74IuHw_sUtByBSha_jkOg-hPj2J55tfYM5XUptU1CL2-ZGm83gBWAFmsmMa5c_qyhRSmQhbzkqbdpDdnuqqsCKFg/s1600/back+to+top+6.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0Qt8NV8t2qlgzkZod4I1XWYcHeHg0ffLiZ7XPg_R4KhqEUhmnrIgf61SOvYuKPfv-a5tFdppmTra-uI_z8xPT-CjVIFqQ2EabWCpIc-rWYiPHISmCnnS9VImiVTBdGI3qdJ2w7J919iA9/s1600/back+to+top+(4).png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyq7w-Wk-CWuDnBdGQVeSOSy-x5Ow-SoLZvstQr_h-Ctuw4mEcxObtHFrH1IGmJFfCOwIjaLrxPaGIlnTCWo4cKLNCOjHYPtxq2r6a0dF79qsVjjPlbfi3ul-puef0m5QXOFbHJzIip0d1/s1600/back+to+top+(1).png
Terima kasih sudah berkunjung di Tya's Blog. Semoga postingan di blog ini bermanfaat bagi pengunjung maupun pembaca blog. Jangan lupa berikan saran, komentar atau kritikan untuk postingan ini!
0 komentar:
Post a Comment