Bions And Friend

  • About
  • ADVERTISE
  • Contact
  • F.A.Q
  • Update

Memasang Smooth Back To Top di Blog

 jQuery   

Memasang Smooth Back To Top di Blog

Memasang Smooth Back To Top di Blog - Mungkin sudah banyak bertaburan di internet tentang tutorial cara memasang tombol back to top di blog dan kali ini saya akan berbagi tips mengenai tutorial tersebut.

Peranan dan fungsi dari tombol back to top sendiri cukup penting yaitu memberikan kemudahan bagi pengunjung yang ingin mengscroll halaman kembali ke atas dengan hanya mengklik satu tombol.


Catatan : Jika di template sudah ada tombol back to top, silahkan hapus terlebih dahulu.


Berikut cara pemasangannya :

1. Login ke Blogger Dashboard > pilih blog > pilih Template > kemudian klik Edit HTML, simpan kode di bawah ini setelah <head> atau sebelum </head>

<link href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' rel='stylesheet'/>

Jika di template anda sudah terpasang Fontawesome di atas, abaikan langkah pertama lanjut ke langkah berikutnya.


2. Simpan CSS di bawah ini sebelum ]]></b:skin> atau </style>

.smoothscroll-top {
    position:fixed;
    opacity:0;
    visibility:hidden;
    overflow:hidden;
    text-align:center;
    z-index:99;
    background-color:#2ba6e1;
    color:#fff;
    width:47px;
    height:44px;
    line-height:44px;
    right:25px;
    bottom:-25px;
    padding-top:2px;
    border-radius:5px;
    transition:all 0.5s ease-in-out;
    transition-delay:0.2s;
}
.smoothscroll-top:hover {
    background-color:#3eb2ea;
    color:#fff;
    transition:all 0.2s ease-in-out;
    transition-delay:0s;
}
.smoothscroll-top.show {
    visibility:visible;
    cursor:pointer;
    opacity:1;
    bottom:25px;
}
.smoothscroll-top i.fa {
    line-height:inherit;
}


3. Simpan jQuery dan HTML di bawah ini sebelum </body>

<div class="smoothscroll-top">
    <span class="scroll-top-inner">
        <i class="fa fa-2x fa-arrow-circle-up"></i>
    </span>
</div>
<script type='text/javascript'>
//<![CDATA[
$(function(){
 
    $(document).on( 'scroll', function(){
 
        if ($(window).scrollTop() > 100) {
            $('.smoothscroll-top').addClass('show');
        } else {
            $('.smoothscroll-top').removeClass('show');
        }
    });
 
    $('.smoothscroll-top').on('click', scrollToTop);
});
 
function scrollToTop() {
    verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;
    element = $('body');
    offset = element.offset();
    offsetTop = offset.top;
    $('html, body').animate({scrollTop: offsetTop}, 600, 'linear');
}
//]]>
</script>


4. Setelah itu simpan template dan lihat hasilnya.

Result

Dengan tambahan efek bounce

<div class="smoothscroll-top">
    <span class="scroll-top-inner">
        <i class="fa fa-2x fa-arrow-circle-up"></i>
    </span>
</div>
<script type='text/javascript'>
//<![CDATA[
$(function(){
 
    $(document).on( 'scroll', function(){
 
        if ($(window).scrollTop() > 100) {
            $('.smoothscroll-top').addClass('show');
        } else {
            $('.smoothscroll-top').removeClass('show');
        }
    });
 
    $('.smoothscroll-top').on('click', scrollToTop);
});
 
function scrollToTop() {
    verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;
    element = $('body');
    offset = element.offset();
    offsetTop = offset.top;
    $('html, body').animate({scrollTop: offsetTop}, 600, 'linear').animate({scrollTop:25},200).animate({scrollTop:0},150) .animate({scrollTop:0},50);
}
//]]>
</script>

Result

Untuk setingan warna dan lainnya bisa anda edit kembali sesuai selera, sekian dari saya. Selamat pagi dan semoga bermanfaat.


Source : http://arlinadesign.blogspot.com/2014/09/memasang-smooth-back-to-top-di-blog.html

  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Post Older Post Home
demo pesan

Pageviews last month

Popular Posts

  • Exchange Union Coin [XUC]
      XUC will be available through a crowd sale open to the community   WEBSITE   WHITPAPER   The crowd sale will run from Aug 7th - Aug...
  • Royal Kingdom Enterprise
    ICO details Token Sale Ends On August 11, 2017 | 22:00 UTC (+00)   Contribute Now     ABOUT Following...
  • Reality Clash
    The token sale will start on 29th Aug 2017 17:00 UTC. It will end on 29th Sept 2017 17:00 PM UTC. http://reality-clash.com/  White Pape...
  • Symmetry: The Safer Cryptocurrency Fund with a Monthly Dividend
    Roadmap About SYMM https://symmetry.fund/ The investment fund trades and invests in ICOs and cryptocurrencies...
  • Everex
    Let's start this journey together  We're adding 2 billion people to the world economy Everex is a young technology startup i...
  • SOSNOVKINO
    MODERN INVESTMENT PROJECT IN CONSTRUCTION INDUSTRY BASED ON BLOCKCHAIN TECHNOLOGY Organized for the construction industry, based on a r...
  • INSUREX
    Opens: July, 11 2017 14:00 UTC
 Closes: July, 31 2017 14:00 UTC InsureX: The first blockchain-based marketplace for the trade and man...
  • Introducing Rivet (RvT): The decentralized & mobile cyber security token
    WEBSITE   WHITEPAPER   SLACK    TWITTER   FACEBOOK    BLOG Visit Our Crowdsale Website Read Our Whitepaper Rivetz is prou...
  • EDGELESS - Facebook Twitter Blog Bounty
    edgeless.io   Earn EDG tokens by participating in EDGELESS bounty program There are 10 000 000 EDG tokens provided for Edgeless ...
  • EDGELESS - FAQ
    WEB | SLACK |  TELEGRAM | BLOG | TWITTER | FACEBOOK | REDDIT | QQ | GITHUB Q: What is Edgeless ...

b͡ack aswibions™ ©