Breaking News
Loading...
Senin, 08 September 2014

Cara Memasang Back to Top

9/08/2014
Cara Membuat, Menampilkan, atau Memasang Tombol, Ikon, atau Menu "Back to Top" di Blog Blogspot

Cara Memasang Back to Top di Blog Blogspot
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.

Nah, dengan adanya  tombol "Back to Top" ini, pengunjung tinggl "klik" dan tampilan bagian atas blog akan tersaji secara otomatis.




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/AVvXsEicNNB-gTRWSDTF-xnYkrmdULNVSLOqF7IP5G6pgdSEUl0iNCRi3pVS_BTYOvRkK4yx_k-ZO_tMmSKt5vxD3Swd6I3F_Qt3vobwEWddM5xaehMGftGzupLhkn-WlsU2uylHsD1IfWylJks/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/AVvXsEghI5a1H1Amv0Yif6YFIVF-EPZLFABcUgtdA5xL3L2WBOnCcMG0trreWBMfJX9sWvZaOZtu2zyxOdp0byp_AQDxVuOgDfLBKgAR8Zw01pRNem20RQoDYB1XHjmjC3ZvZfK0GQSGLfFoml8/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiINluuAByZ9npbRN5-v4jfbyQ7lnowRJNKD_bQdPNCpWeqH0EyIsF-sCMa3JVKbUJ5x58SDVYlhGFKK1KYUETTDtXpyq0N7E7yqbtnEEVcEEdZ-WpLjLnBlF_8zYEOFtl2Et6qrAr7z2s/s1600/back+to+top.png 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeheHhR-7yBgJTKZPczX4tOxv86OZwvg-fKerFgziITCy2Hn_BeFXo44nd8D8u5IoEDbL8LyThvO_3CKDMRWIhQwngR9uCzUxogJBUUzi8quIlshrjPXkE-ZWtU4h-9DmqwdG1iTCUNiw/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSwrvyMuv2Pob57bUOkeAmPRkT-1IPtBJsqqUcmC4l7EHwxV-JIc-GZnWq5W2aLJ6iUYMTJkwOVEUQlQAOPgctpEFPpMQsPJh08BPm_Ek-mHkk4JnQprxl-fayhLi-h9qhCfWLFqyfJIA/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz1ia-fYzRk6QU4zqqPTerey4Ye738bIwiXKg5wKoUwc-1t6_CALrSpAHYPN_5aoQXfaSojokk7ScYSpYPhkhq6ujS00VogU4leY1C_wdJUzsErHOQ-2jrj_aPqrWD6w37mgTWwhVGHio/s1600/back+to+top+button.gif 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQZHX2XcY6E-ZIeOtvMRkY7vWFoLBBu5nISEee98kTqgfI4VCckk0OB2avW_YABSp9A4z9ucMazN6JNTZvEEpB9CuNnHt1uA6oywJ47J0IP4-Z3sVAvyVSYNxuN-RZCP5Lmq8gExnJW5w/s1600/back+to+top+button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy16giW6osYOk9c8f0LsK5JNyODoqsz_9wsQOqUVvycHINzg2o5BaotIhLhCRa-5_-1-RSx05VMoEFiD6V5dOK4jb0PHzYX3IeQTDwQBwj1eDx6ZIG4MckL6-IQSv9j4bxqeOgBSUuzuY/s1600/back+to+top+button.gif 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYQfkNXOKwUBurKBJ_tnUyTVhV404_lUWTWjm5tZSQkWj633Jmn1YO_Eo12e1rzq6N2VMD9WxnMJvFE8R_EaIqQTgcw-_YxgdRQDksN02AZPSVXHZDsvIaMME7oLNb_l_fof3paFGDeyU/s1600/back+to+top+button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicNNB-gTRWSDTF-xnYkrmdULNVSLOqF7IP5G6pgdSEUl0iNCRi3pVS_BTYOvRkK4yx_k-ZO_tMmSKt5vxD3Swd6I3F_Qt3vobwEWddM5xaehMGftGzupLhkn-WlsU2uylHsD1IfWylJks/s1600/back+to+top.png 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoQoAorBvmoVFHqb-u0Bc6BKJaq9maGEfurhIzENKtpVow3w6biVQp3iyMgaWNPU7oS-uFdZFJz7Z1ZLmzi7sRRDtxzeYVKDunWZpUqp3fp5FBirzKjl0N_eKmiPZB-S_C97AVRd8h3II/s1600/Back-To-Top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUMqpY-J0eDxKu-4bO7TFCQc-u3ulbKUiWDqIswC_UEb3zqy0CDyiPDGfP7WZqOqfWjDLxuKPaR786-P2DjzpgYehqq8VBVQCVjIOWn-IsZQiavkBJuxfcOQRgZoVPMLpXCQUKzZT4KZI/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK-lhBmPwf8ZI97q7h2EfF65Lx6jJP5BU0qrKsm1qVrdiNFOx8wUFYFaXTFfP_wbk6oQp0G83-YVaneQa5Xn5zP030cMdO2lJ8RC8-bYQtrs3vGT8qpGNmTnR-w8NjvUImWIkwHAUOS6w/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjJhXfI-TPiaP-ll8f9GZ_GGntRQhG3N6E0aOJUoEBA-JCHn1C2GV82Ts4P6fffP7FUvrhgwSAKAbm84RoJosrMQqmoevuICs-9Xd3BE1Y3Nj5KDk0mWseWxfq1XYVJQ5tSrQ5M1ix8xY/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1GqtVVEBF5LW0aJd_kiccbrBv6SaxLEv3KnbVS1mHp_lIEBxi3ZoU3zW5PoKcYelJC3abew9evFQOZbXlIEOsg5YS9eAAPnXqzj605jJ34oxX6IPZ-RT5VOL5h1323CDGlw9cL6AIYZ4/s1600/Back-To-Top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3B8oePKTG1z7c-0a5K3JK9wqMdNpiN5Lg8hz9kaS5KFNUFyEwBapDTfY7qCZ5HZMmKpMDBKGJB8AymBZYQ029csiI9jAztfkUVPu2POH62yqXaBoEIWfrNrFg_UsFIIcC2Piw7Ti4was/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!

0 komentar:

Posting Komentar

Terima Kasih Kunjungannya
1. Berkomentar yang sopan,baik,dan tidak rusuh
2. Jika ingin mengcopy artikel ini silahkan cantumkan link sumber
3. Dimohon untuk tidak mencantumkan link aktif
4. Jika ada link atau gambar yang rusak/crash mohon komentar
Terima Kasih

 
Toggle Footer