Powered by Blogger.

CARA MEMASANG BACK TO TOP DALAM 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.


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/AVvXsEhN8rvoamgdsstxqSG9Ln7EPvG2a8FMSAXCK3BUzkciLX__iUgqeEnP7yG2-xN3Ifm8y5NNg-RUVfjFUvpmgXB2oi-sXGQ3JQOe_WFHpIe6Bdn0R4ukSL7vGZJtaxKL-BKzMhSsMdl_aok/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.
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQnia3Eh2xxWlF0E63BZQUNY2gi49LAYca30t8lUAEq3ay9DXcQfBycXV2V6IxopfNl_mFfqu27ydltjeYUvx-rk-2Nc3_a7ModOhY2lNidqpc5Xq3bq0XLKRJv1gnT4F7jH0yfAQMeA8/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijnh2gknf19RDphvjoPtTxlzW9mk_gb-DqYhRRldyi8DbbdYRmC-DXleStzhMTNbuzAZ9NgrWKZMCMz4Z5wIqC1ElFPznhPQqE4sV97o3_2tKBTrZnxOqvCf2WyYvQIUre9ZcGDjLrxw4/s1600/back+to+top.png 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb9jgzQmXQccqanVBSUY5GEeQYez7qQr6LrvnCVz9Umr0oIM7V4vu14Kte3ij0Zo9knvn1Jlcf8cJ4lAM6178fYMk-loQ0yoAE-Nxelf_WNr_OutMuPD4Fp5Z6qO_DDvbus5DT-SdoNGM/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi0Xrvey04d_bwnPlpnF4oJmxg5IRJEb4ltazR1qUIxwQ5z7OEaGnh6BIQ_L7R8wy7cBiDsfxnb1X-yZHKlyfDhUh9A6XWk9a5zjfL2dUdnbL42VRqLdP0ey4CSS2W5TKNLd4AwfjEzsQ/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl0enaQb5IN0RAh1RN5rblTgXGGeFKM2rTvRCpXhfpaDvJGK0wqeOXnE1ykQVuDcM_vKWo1wUOKy7b3N8D7SVd99-2imCPK41S6Z6ktr2rHVnd_0RCWOHUE7Wx24TuHt3YqZJa_cpXO0o/s1600/back+to+top+button.gif 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB04wtjsE7ZjXYYs7d_673OAduwl5F44u9-xliaJl9IFFzMfStenxhlt0VWpDkVhqBUxEeCTRVRcE-cqRxvrMBt4HSt4ocOf703kY1Te74JjahIp7Laygw03PXg2hz7zL_UYoIs9p_zGQ/s1600/back+to+top+button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDVvVp0MOZGO4phBgfGOvdugOK8Mg1Q8AZ6UZeReAsIaDpEXZ9mnOK2GFQorNBU7tYjb_wY-TGmEf2iCzzISkGeakLBSGKgjszG0OHVmJZPcKGmWXy5PH1dIHXa42S6EaFzLweQPk3z7A/s1600/back+to+top+button.gif 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-EtcJea1bn5CDC2pAiXgPHAhQ5ismjegYDbBKgvUihtm0G_mI7C04H7I0WsGXXP56JD4LGynSSMjUAfAIbnPlZpFVXC1Q9s1bO9DVIk6yU_-V_PIKdvF95rIM_BgxouRw1D1SoDkfZuI/s1600/back+to+top+button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN8rvoamgdsstxqSG9Ln7EPvG2a8FMSAXCK3BUzkciLX__iUgqeEnP7yG2-xN3Ifm8y5NNg-RUVfjFUvpmgXB2oi-sXGQ3JQOe_WFHpIe6Bdn0R4ukSL7vGZJtaxKL-BKzMhSsMdl_aok/s1600/back+to+top.png 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3zeWmVM9mA79AVkISc41bbIItp61CruFQxpqLRNsplUxugrR4gxqZOOu42HolP2x5UUXdgR87tMe7LzbZRVkdH24qZt8QNMjLn2WajyCmWhplPpaYsyqojRy2F0g0xENvnGAhV4NttYA/s1600/Back-To-Top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTv5xVUrEelba5Yx8Xq7mxT8LpUPoP4fEH-DxSy1HeYgU5WPcS66n7NN74tz07mXCcwvD-9G5LbtyrgS8L8RaKNA50sOHjHayrEgvYPEb7yTvsV0_3tL0Z1aGOm7i4aO_gWIDBDs4Q1lQ/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Chi8fe7FJxvjb7OPUWlBvfU4T9Ra_VOMNYHtQu-550qk5TPg2HLAmy3cs5yMT8KdcCWaZuuitcOWK8SQDu4UCV3v5EP9JU7G4fn-wbjaQrg8gl-CTg7Ckg23k2OW63CrBbV6LnIpyGg/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjeEB1c_TJun_f2RADAJ0jPAGobMfgwRJPK0NQAB8JrealNFWyNg5rSZhWkx8Dxb9DrzNebD0eGFVUprL56Vb5mJRb0TJadELi4ZPih4A_LfPznkQxFMzL1iQmwz9O1lyaHE4TceplTh8/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTz_ME_R_qde79QJrmYyjQzXw4DWOY28yLZPTgyX2Df7NfeegZbShS1BGuUT31WMheIP9AZOLvGOD8zJnmQKz78Ys_6DhPFzoiFqRV5Hkg5-oROFJ9JStT7JNlhj5rQ4WlxrJcmyGCwhc/s1600/Back-To-Top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio8YzV9ujFNEm1wwtxoqUAeiFU1sbIQpAsm6KK6qQhZCW-D4C34ui1QB4owG3fnbC0aJPCt40IkbzajIpOzuS3u0vfGc7_sEbRcHhLRWaQPwbOclIe38fim4shEZepgfXxQ98cqxG3kI0/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>

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!
Bagikan :
+
Previous
Next Post »
0 Komentar untuk "CARA MEMASANG BACK TO TOP DALAM BLOG BLOGSPOT"

Syukron telah mengomentari tautan blog ini, Insya Alloh jadi refleksi menuju berkemajuan

 
Template By Kunci Dunia
Back To Top