Cara Mudah Memasang Tombol Back To Top Pada Blogspot atau Blogger

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

Baca Juga

<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

Baca Juga  Cara Memasang Tombol Subscribe Youtube di Blogspot

    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
        }
    },

Baca Juga  Membuat Halaman Custom 404 Page Not Found di Blogspot Keren

    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()
            })
        })
    }
}

Baca Juga  Cara Menghilangkan Tanggal pada Permaling atauk Link URL Blog

scrolltotop.init()
</script>

Ganti URL Gambar Back To Top dengan salah satu code di bawah ini;

http://4.bp.blogspot.com/-nhvmIT-UOiY/USDh-EyeKDI/AAAAAAAAAjE/hjEdj5OMvO0/s1600/back+to+top.png

Hasil;

http://3.bp.blogspot.com/-ggvoO88bhfM/USDi6IWVtFI/AAAAAAAAAjc/n4vpSkZgR00/s1600/back+to+top.png 

Hasil;

http://2.bp.blogspot.com/-BkNGUImcIV4/USDcBMHYjqI/AAAAAAAAAig/qEtwRO4pH6Q/s1600/back+to+top.png

Hasil;

http://3.bp.blogspot.com/-Urx3H8aFQmY/USDkbnvSsLI/AAAAAAAAAkA/Wm4OkKT9yRI/s1600/back+to+top.png

Hasil;

http://3.bp.blogspot.com/-WH_FEtT_Cvs/USDjPDtErPI/AAAAAAAAAjk/0BNlHdiUu9w/s1600/back+to+top+button.gif 

Hasil;

http://3.bp.blogspot.com/-X5sq11nsiNY/USDiu1zNWSI/AAAAAAAAAjM/8Y6vn3Vx6kQ/s1600/back+to+top+button.png

Hasil;

http://2.bp.blogspot.com/-PEmadyDjsUw/USDjUyqlWsI/AAAAAAAAAjs/oVRttmskRfc/s1600/back+to+top+button.gif 

Hasil;

http://2.bp.blogspot.com/-3sXsLU1aW3s/USDkamRLRZI/AAAAAAAAAj4/UOoh-GJWUdI/s1600/back+to+top+button.png

Hasil;

http://4.bp.blogspot.com/-hsRaTBL9lpY/USDb4Wzo2WI/AAAAAAAAAiU/2eSTakNmCOE/s1600/back+to+top.png 

Hasil;

http://3.bp.blogspot.com/-yhJXvPXAuNw/UQLk-mySRjI/AAAAAAAAAXg/pIAnUf9q1c8/s1600/Back-To-Top.png

Hasil;

http://4.bp.blogspot.com/-BWmnRp-sR9o/USDmkStjAcI/AAAAAAAAAko/q6nJN8bXMZ8/s1600/back-to-top-button.png

Hasil;

http://2.bp.blogspot.com/-C3ZJY99YKfo/USDmD4KR-zI/AAAAAAAAAkY/3fO83hpF2Zk/s1600/back-to-top-button.png

Hasil;

http://1.bp.blogspot.com/-b3YWne8aCdw/USDmXTnyUiI/AAAAAAAAAkg/SieNqYTVQKQ/s1600/back-to-top-button.png

Hasil;

http://4.bp.blogspot.com/-y2BIm2-mphA/UQLlFFt1-MI/AAAAAAAAAXo/lXvFBVnpLjc/s1600/Back-To-Top.png

Hasil;

http://2.bp.blogspot.com/-36z7H3mWlZ0/USDizr47anI/AAAAAAAAAjU/8SoPm-odD7I/s1600/back_to_top_button.png

Hasil;

Terima kasih telah berkunjung.

About the author: Aan Channel

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *