Tempat Software dan MAC Address G.Warnet Gold Gratiss

Friday 27 February 2015

Cara Memasang Back to Top di Blog Blogspot

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


Cara Memasang Back to Top di 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/AVvXsEj691uLHi_LJ6xzGtKXBWd88W81DlhaA-eCeP-rKzeWD4hMnQfDmTRf_r1FoDCms4HY7t5s2QSDbmG1deynGc7umwjnrhhSe7Q3dFW0m_eWTo1TSjoDT6gJ33xx1I3hzqJZ73MKFRyU1po/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/AVvXsEgFqKothOEavHPz_dyst1tbU-SknFqEDHusTh_dDC9R-brvIhvV3yxhNfotM144aJwU0vZLYjLmEf4YxGhGcAgfk-WW5qVO0G6ytZJG7XUBZPGR0ILTK8xuywAiWQsZRyNoA3lcjiQegFM/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVsSwiBriwLA2g2y5HRxMnD2W1CGy2KUpfxslTg9YGP8jj8JEFRqdkDUVy836tbPYZC_XWiiLvRVC94M0bXGS0Bm1xCLL0yagBgpSPEl689pz6jRB747PB7dxtQZd5HfNXJ48Q6ds4QP8/s1600/back+to+top.png 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghlC6oqHy_ndGF-VZPTlOdb_QOTnet_n9Labq2ECdH9uHkW1Fs24KRHz-nCBEZZ7oK3u0eWh_r0C2juUsfhmBJKbScPIBHlmh7o8kecwRKZUr4467Osz5p-MAB5zeQX1v15-59nOyYwfg/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgobdQLxtJIkMO7sZoDhyZhm406nqDqtYVyINTq7ya6B4eGdINw90iSHoW_BSkbLKh5YeYmzSwWUYWt1N_663HbGX085wbNP4gdEuoaX0fdsJhx2aR0dk0OOy682kUbEBsRLFSE0INCZKc/s1600/back+to+top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFipk1cewLao3ZjGrfrYqCAxYhW6yuCvtvXqkyFThEObZnbk5JzMwxa-Ed4H_QOAmprcT4Gz7vZsCcycaJxnVxDPjQR10FJbdO6WqeHr0Pzaey73VML9mMupKVs0ZKF-sB23n01cAN3yc/s1600/back+to+top+button.gif 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN_T2-AsCVnJePabFSxnNVwjmSn2WZxZLcPIvqRnG_DgmW4oiNob_b25tMh_AKx2XyhxmgRcRHNddFAw1dZEYNnRBNU4xW9QlMa_8zzZIB8jDAihzTR4gas67FfyBsM5MlIVjhr6mWDhU/s1600/back+to+top+button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7Ij5H7ybGKb-o2PNUU4DwPRNRm5Eg7MPvmkOjC5cZA-V8CFIBTRRP-qTHBT6b5TwnE3DTih2j78CvaueWEza_M5BcCTFuDuzgRjxfOlYK258mbGyh5KrjF72jfRkz_PvLGvE3Bpl0_js/s1600/back+to+top+button.gif 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip6Wq_eoYdacqkx7jwH2w39SDv0Sem5cCS8E0sqtPMqKy7jpsLTBa8kRN0XMKvA7zwAExt8cWpsxq9Oh33bgWwqpwpb1OkUQHpMJXxNUUueQe3rZYDr4Fx4Fifm52snmYmAMRoYrnrjT8/s1600/back+to+top+button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj691uLHi_LJ6xzGtKXBWd88W81DlhaA-eCeP-rKzeWD4hMnQfDmTRf_r1FoDCms4HY7t5s2QSDbmG1deynGc7umwjnrhhSe7Q3dFW0m_eWTo1TSjoDT6gJ33xx1I3hzqJZ73MKFRyU1po/s1600/back+to+top.png 
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgbJo6ikmzvPmWCLiek0huoVU_7F7Phsh0e72L23pjN-qvcersErrMJmvI_Ygrf6VNSaXNPcQB8oSmTLNV-Rm3c1aRnW-2DUjVjo6s4LAcafM12iMIQHANuhRAj0cEA0Q4oVY46pptIxI/s1600/Back-To-Top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-SnK9ZpcZhFuKvrC2YEpZuvDpCX5-JMZWAFrnolHMNWH377_amzOLBm3Gk9jdSyQpjqtbXlcG880VneThSgiR9vJzj_DJLcHrs1E15FUEXYKYrfOQSPegc1gmZCHt99aurfpmJ1r2A1g/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-_NWa92U6XPwaZFKYYgLID0i_Wf2uucxfMWu3fvELFnokEZceX85sRzJ_G-vlZdBwkQPGyOPnrmacO1pzQgUP-vnl47558diDU9XWnkZl-7MRgNLJ4D3iEGcwCIoHl0tgdvza3m7R-A0/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzivJ2tHy4C6JTphXuZTFSZFGZdEqw_GfgP6lpffGVG8vmDg4XK6s-SWQbVsMS2r6fN9KKSIw4C1eqEbGiYCBhaKZA_gC7Z1apI7FDg_X7GaSJkcXM1h2sO3pqUakN5ap-nsYt0PHu4so/s1600/back-to-top-button.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzB-csr9IxdMgtdHvXEbgVgNHPgt5p9eDhl902NtkjPTuKIuF9gfmsKSa9Cc4hfzMFPWo1uT-qntzLDTGgqxClOu59Ep01EBillmpR2sAxgI6OhZK7xTozDSfwSlh892j1-dgG7_RazZA/s1600/Back-To-Top.png
 Back to Top di Blog
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiTMbf2h8WK-KmG2yoCyHV5jpjgEzlCpj7lBOHY26lozfm0xmXyf7pXVDOE81wWqvsdhoqcxlcmAuIXzbliXqljadaPHTIJKdAH5fwjC4XWW6Oy9va3c8XUR6ybO9Gx9zhXf7zPupVODQ/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!

No comments:

Post a Comment