defersite

Cara Membuat Tombol Back To Top Keren Di Blog

       Kali ini SA-RAH bakal ngebagiin salah satu cara untuk mempercantik blog saudara, dan juga memberi kemudahan untuk pengunjung blog anda.

    langsung aja tanpa memperpanjang situasi dan kondisi, monggo di nikmati.............

    • Pertama masuk ke Blogger lalu pilih Layout terus Add a Gadget dan tambahin HTML/JavaScript gan. Terus tinggal loe pastein kode di bawah ini di kotak kosongnya.


    <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>
    • Kalo udah di pastein sekarang tinggal di ganti URL Gambar Back To Top sama url gambar punya loe gan lalu di Save. Coba sekarang buka blog loe pasti udah ada tombol back to topnya gan.

    Kalo loe gak punya gambar tombolnya ni gw sediain gan, ada yang animasi sama standar tinggal dipilih aja.


    Animasi :












    Standar









    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcxc-mqGeabtRRWzd48wvv_tnPTLStwibDIk2C_HS3fjFa2LbiSViuVJob2mIYQb3ZhemWslTLlrjxZf6tnqmAQB40EVGMbLryImahy3Ag03iyuVdu-EfOqH78jqiwtRWyAVZHaq40DGw/s1600/back-to-top-button.png


    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQ6MgviohJAzC5GMcZZdVo24CCyIjPeh8gqBLITz4E_Nvyut-app0DzpHs9CAV85JrR1hqNLiPGNC_gw8krKIQoLk3N3Z1QBxvd0GdnBFWXigVXrgbxp3LwLjHH4eoFvAcKY7JQsWon8/s1600/back+to+top.png

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBvB5JfGZv72UpgFN8y4foO2r0X4yE5SwpwHXxO7_sYTLp5i1l_nE16MlX-E8F9P7KBs_VrnIzKBmXfqTg6sa8aQpD19t5HfBOXK9q9YSdkj3WLb0Rqx_cNjqeqeGG9YUJLTNeI47KTog/s1600/back_to_top_button.png


    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg3lApBNc06ojjw6AQOjHyaNmAUl3EysbVeXnraj82ORAqROWGGxUdh5XTTF4sYfX2NumYg84La33e5bFqgqeUsQ9puS37LWpF7B4cTo9w3S3miTsCpsGGRKtsd0aChe14kt1ZTwaHzhY/s1600/back-to-top-button.png

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6_Hugy48uXWC-q8NWlcmKfkBOBggcwRu13EGFLr6iS6Y60UfvAzNayBlRKMNyfDyOuDrztA-GQoNKjk6k3oyM_5QgIRSQjmQycFspaWjPKhzEwWVr5AAU88AeeMdoZIEL4MkTFcxMSLs/s1600/back+to+top.png

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj1YMoFlw50U8rhEKcLMmbGOQM_PMe6kd-DxT7HoiUggN_IJ6_SQoVgMoVmWqw7gwbYBNvq-p4UjSpre5y6ZdjRZscz4aDDC8x4rIB5fvaBhgIzN8vj3ZjjAZkc4dnaN3HT2I9DgZ5Z6Q/s1600/back-to-top-button.png

     

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7MYD5FrN24PmREfwr149SKp92O-okQ-DL0D80c3SKJqY2-VFgRdPcmfyTLXD8SssnaKyWBQTy73Fmk2iimwTYH_3ArEkCb-pvpI9vbM28TNLh_i4EzQD4QGpghJhpbmQkxrfD8i-EMUM/s1600/Back-To-Top.png

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_lhicHNoDv10SiJ-UC7VmGOaqOrTRKsd0UaATqR8liRCHxyjXJFyhlxurXEe-HcQUn1tpkZd8qSgzulOnbIghTREAsS8SGb952onQpTltbW9Y6Pf2XlIsnYIvhJoO2JWXicF-r8AmwCg/s1600/back+to+top.png

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEier0v9cY1x8tB3Gr2KIt0hqe5LX00API73R6po7G-7f-N7aiC5HBtLR1pHJWu0ZQckmbn4P2cqjqpf9l2ZjW1h6wEli1Yi3xFIITpxTqk6_qcNwjdOy3cWA7QZBly69yUFpcOW5ZeE9uY/s1600/back+to+top+button.png

     

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKzXWBwLhd3_tzywwUF3UB6bIKgQO-Haa7Y0weNkQ4bQ8V0GzhTF9GjDlCUGWXN9TBpHJ_ZGSyYd_BxttTTxfrJGdeW7dHFuuyuAV8LHlc7qUc_UTaUF8PfuE24rFdhavYIWhPS8KC2W4/s1600/Back-to-top.png

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic6D3VVOYMAwyQPfPYDm6Gj1okH700JN8xqoq688IM2rGiLCtn4W22LUes1xmGqtkALfi6hpeJ4-QQXZKOFTdtkQCyVId9_fuchNFSLFUVmdkDaJPX0qdfntlHRhUA73hOrfzsiZ2uX9Y/s1600/back+to+top+button.gif

     

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8QCAuOqT21mDdz10uRHH-TmTim0UcHzwqpX_QUfvPQL_Gga6LRXqo1Xse_53EnWqMEQrNHBUUMhobLbfAyBc9J2TuhO-pmeugUgTlhZOU0RWOrkRY090L6c-j8K3-xmv_7AGvGTXCHw4/s1600/back+to+top.png

     

    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLnBS_BkfQbD1arzj0xkN1mH4V0r6SCmWz0HSH6N6t47dnW360iK07W8AEYMekIHIVSjq9pj9D-LyjBKo1A5jm4cxQdWzx8vfHXuwQ0hhzTy5uI6e3yjhTO6HhhLgO9WFE5u_CKsLpeo0/s1600/Back-To-Top.png

     


    back to top button
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTiJ27AL1d8UB-kh2PmTPyKVtZPwjGNOg1vW8ds3uHg8t5y1CCbhdH1NWDEeujdTQmT5tQsqVjOumYdDkMVSYSgoOjhexGxv5dfIISxdi0LLArgEyVVEsrofk68bPmI-xosdhxVE70DiM/s1600/back+to+top+button.gif

    Admin

    I'm just a beginner blogger who tried to learn things related to coding which always appears in front of the eye


    EmoticonEmoticon