Tombol Back To Top sangat berguna untuk kembali ke atas pada suatu laman blog secara cepat, sebab pengguna tidak perlu menscroll ke atas. Melainkan tinggal klik Back to top maka akan otomatis kembali ke atas.
Berikut langkah mudahnya.
1. Masuk ke laman Blok anda
2. Klik Tata Letak / Layout pada blogger
3. Klik Add Gadged / Tambahkan Gadget
4. Pilih HTML/JavaScript
5. Copaskan Code berikut ini
Berikut langkah mudahnya.
1. Masuk ke laman Blok anda
2. Klik Tata Letak / Layout pada blogger
3. Klik Add Gadged / Tambahkan Gadget
4. Pilih HTML/JavaScript
5. Copaskan Code berikut 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: '<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>
Ganti URL Gambar Back To Top dengan salah satu code di bawah ini;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUvaiJh5vGVtb4J0UJSXeRaCOO8LSzp3zAy_eN2FPH-N_DuJ-zGLpi-XZZ1wllcG1lkWIAj6DHZ-JjlpqdvtTgDxMJvB6EGPC0eYIj2LiixPpYkho2o7o91aUbHdn5HcIhn8Ao8USeZFs/s1600/back+to+top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQi8Kko2E0lreMgMWRXMn9_Hdyos7hDq73G7tB8U-EV9NgnpM-5PT03gSfzIAZdS94no3Fxp59NmCwfn6qXSPngvBTLvTmqRtJhG6m3tBUfoBnKthjq5kRj_Gpy2dWSuHX_RG_wKApscQ/s1600/back+to+top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe20Hb4FOErlzBKmqZWGbNnVoTfMtU9a4Fno1L23qOsWZV2JZtEbHgsESFOwBjziuYm57lQW8b8e-z_jHvUq3JFSGiPdtUJ88PbUiglJNOfl0r4FZNpmMXO1Nsg7JLC7qKzpI1k-Mr0N4/s1600/back+to+top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNvoW-48AqnkDCzx6hP54ntbLiSjmNWlb_hkVUmXqsYkaK4FJ5jnaKeUjgupPgCakV7dTw3CMrctzksND_67lig-136dYw1T-8zbULREXgREA4r04UsjZoL3MjuGiPr2MuglaDqK_RGx4/s1600/back+to+top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6k6fDIHOj2oYhqhfsOu9V8oXm_tS-YgISz3Op1NmGX58O4UL8JXZ5GwV2zxci__qKvRuK97irMhpy8eXrbPw1OOtUulubOrpH5zPzz6G-iQEONtZlAoMz7yJyY-8kvCbPw_taa_3pFtI/s1600/back+to+top+button.gif
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNCVCijiYJXBAGSLjatIZVAvIh41mnRRo2Ey0-eyYZVsbTh7SB9FQyErz77YEwnBA8bXIraocClPwZWvsq2W81kXBNir8gQ2SvM9PNJ3ZesqNK6r2oFo6x9rQstbAauIheVRBjFtHd5uw/s1600/back+to+top+button.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6U7FUozMMJTC_lVQzH-bPMVcYUiBwoJae3F-WT1DQXAGS9vID4wCymEfx2wbZItpsisdWinhc8hMV_XOwTv7XhGwbWjoc_dEh6Axqmxd3etuJ1k6iozHZiOCSX5Vb83C2sZjzJAjCvjk/s1600/back+to+top+button.gif
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMjuprw-rrmEe2WoXKr5vPm8WWAz4FNPTYtpCdVTvwSpzjvN7G5wylVFFxl6iGr0KsUWFW3mkR1eWqc1sWUIwActFXiIur6DHSjvSDEnsQ2aHLi0XmNDL5XP_UNGTjnKk0OiNLw_2f7sU/s1600/back+to+top+button.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYM2up9ilbMsncNL_GxtIhTacWyHcCkbWdrlbocOPBGvP4MUl2onadDAeinU2ApFLTrqt6DrA2g0MO94fITzqUNk5r-4B-OwFrYkxNW07Ma3GVVLH1DFb-ElAnSsOp82tW6yO0z2RDYgk/s1600/back+to+top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ7lhaFNdR4Hg2ciFR4cJYzX-N46oIJmMIJHfgJBnx1Jcq8a81NdI1gUAXy9DzvGG26aJgoIDayZC85fKuwE7FzCe-7XXwuF2pFziufv1UJ8qjzPoj4PEnbNOIFHhCQY2tImW9yDPgNcs/s1600/Back-To-Top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoR0SdirigCIlKuf6g9oDyiviFXkiHDcm_XgtrMR_vitotnbsEsp7V0hbcgfZ1aF5HhYDXQ0HikFn84b0Q26f2kLvikl3uxE2KHIyEuW5iEK4JHzmZyGuEC1XwS7BDLaAx_xpEyBY1wWU/s1600/back-to-top-button.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8yZPjS6ruA8L6UOdgUBMIqzJ5YzuR1SrmwRSXzonzuhH7wrnxIJ5qfGhAcZ_Ma7RytJEDBD-GTdMSfmrkYhhO2PEIJPJhD6gg-wX5n3C2QbMI7iDhpY6p_ALnMndla4ttcTuBIgDDaWo/s1600/back-to-top-button.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSy8pI4ouLPW8ouaPNM8-nYW9SJCHMs94pn_fhUm28g9-WegGtJsnaD0bkx4tRwq0CN683HeZFQxU2aD4-pwTit7Lzs4GTAaxtQbpl8Tbfg9Quc7ze0nobYWDoi_C044tiyF4r0VZilFE/s1600/back-to-top-button.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmpCDKYSI_hYT2tZftquzx3pTU3ZXuOqxDB07xK5Lj8TGIdQlfau4i787UVnNMYVFwJHttHguFUKLjOYR5I3VFtlhAJVF7hHfHmqOsuFhKdEb9Uuvy5aweMdtb9_O-I5-3J727_jqS1-o/s1600/Back-To-Top.png
Hasil;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTBau88ro98AnckfDTx5pNY8B6MkZ06QeM1UnhCrrWdYJKqqZpzykL7yemrGCwFjd4LjRSH5ugtV31rwlWFo8FWZM0e5W0zu7MTzHdMY-6AMSpOclhl4cXhCAyBpth03VJ7vLw_ReYQQs/s1600/back_to_top_button.png
Hasil;
0 komentar:
Post a Comment