Cara Memasang Tombol Back To Top Keren di Blog
Cara Memasang Tombol Back To Top :
1. Login terlebih dahulu di Blogger.com
2. Setelah itu Pilih Menu Tata Letak di dalam menu Dropdown
3. Klik Tambahkan Gadget dan pilih HTML/Javascript
4. Masukkan Code berikut ini
<!--Back to top script-->
<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={
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 200]},
controlHTML: '<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi45IOwBVSRpyotwqg-tdrOQyFq4_QSdzp7v_bLstFi3T1u0QtpPZ1qvySXgvKGpOVOILYDqpOaodHH8DUBFkjlPx8_IdLaQdo1RVgpGL7uyfxzlRGeoC9US8p8TQi52tPVKtAAvn5y0Gup/s1600/back+to+top13.png" />',
controlattrs: {offsetx:5, offsety:5},
anchorkeyword: '#top',
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport)
this.$control.css({opacity:0})
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
if (typeof dest=="string" && jQuery('#'+dest).length==1)
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()!='') //khusus versi IE6 ke bawah untuk loose check, juga untuk melihat apakah control mengandung teks
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- perlu diset witdh yang jelas agar kontainer text terbentuk dengan rapi
mainobj.togglecontrol()
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
mainobj.scrollup()
return false
})
$(window).bind('scroll resize', function(e){
mainobj.togglecontrol()
})
})
}
}
scrolltotop.init()
<!--Back to top script end--></script>
<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={
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 200]},
controlHTML: '<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi45IOwBVSRpyotwqg-tdrOQyFq4_QSdzp7v_bLstFi3T1u0QtpPZ1qvySXgvKGpOVOILYDqpOaodHH8DUBFkjlPx8_IdLaQdo1RVgpGL7uyfxzlRGeoC9US8p8TQi52tPVKtAAvn5y0Gup/s1600/back+to+top13.png" />',
controlattrs: {offsetx:5, offsety:5},
anchorkeyword: '#top',
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport)
this.$control.css({opacity:0})
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
if (typeof dest=="string" && jQuery('#'+dest).length==1)
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()!='') //khusus versi IE6 ke bawah untuk loose check, juga untuk melihat apakah control mengandung teks
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- perlu diset witdh yang jelas agar kontainer text terbentuk dengan rapi
mainobj.togglecontrol()
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
mainobj.scrollup()
return false
})
$(window).bind('scroll resize', function(e){
mainobj.togglecontrol()
})
})
}
}
scrolltotop.init()
<!--Back to top script end--></script>
5. Klik Save Template.
Anda juga Bisa mengganti Gambar Tombol Back to Top yang sudah saya sediakan
"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVYJ63R5eRhaLYSrlQmiaRYGPo7oWQN7ChIadvaMyvJyyOyrvwjTsSRk2WUfcETdTfp-zbDi8MFXc1cLgBtPjBxVS19eXXx2dfa41BE59Ij5HstVNaK-bGHreSCTjNi3fKbuwX8ME0lQHn/s1600/arrow-up-icon+%282%29.png"
"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB1YC81RBzEJwI_MMvSD-8vTGyV7pR1dsaBk-SegjU8X2f0ZjnLNk2hDBspn4JKovNqixnCFzvHxidaKjbgnv4kPcQLANEsXmleZp6YwGNBV16-81B9Sfc6eLUWHRZvciArDOUO4Ldfoig/s1600/box-up-icon.png"
"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDO5EGPZgpbv2eSyEJK9CFJwGwitWhBaKSuj6MGuhwSzjkkepYYI1FElDDjelMNOoY8eb9Voh3c-3Goj1zprAAq6t1_fgcwgiSpSupozu7QjQQK5d4O1wRn5nvI9mzI_qzP_V3b_zKAyjo/s1600/arrow-up-icon.png"
"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlCAShy9x9uSdPKN3iNHfVjEEII59gFXcVprUBo79aBxypXZEXdCbMPbyVevNIKc6lUlLSANVCqQIamJSFUZnwgD_k6y_XiO2BJbcEFTDktOCa2H46_7SouOLrrk0CuZv48BX-z89WC-KR/s1600/Action-arrow-blue-double-up-icon.png"
"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Tx-NQ4XZvqOCoSebXhoV8IK0zz10WWg94-Z74AHUj9IXW5WfqvnUuP53zMQSzfqy0A24tDS19TKmcpiDU5jiXEvHrNbKOYCLEakCaFF9KNsoIOmr4VeeDoD6ZAOILl4FhTrj6e7avblH/s1600/back+to+top15.png"
Dan Untuk Keterangan Gambar Di Atas
- Code Berwarna Merah adalah Kode Gambar
- Code Berwarna Hijau adalah Durasi Scroll, Fade, dan Pixel Gulir Cursor.
0 komentar:
Harap Tinggalkan Jejak Setelah Membaca
Jangan Menggunakan Kata Kata Kasar/Mengandung Sara
Berkomenlah Sesuai Topik :D