Rabu, 23 Desember 2009

Back to top makin smooth dengan sentuhan jquery


Pada awalnya sebelum tau smooth scroll ini, saya menggunakan mode lama yang terlihat cepet n kilat yang kata dokter bisa bikin juling loh.hehehehe makanya buruan pindah ke jquery, biar makin smooth. Setelah ngubek ngubek google akhirnya sampailah aku di DISINI


gini nih caranya mengaplikasikan pada blog anda:

Langkah pertama login ke blog anda.

Pilih edit html

Copy lalu paste script jquery dibawah ini tepat diatas kode </head>

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js' type='text/javascript'/>
Lalu tambahkan kode javascript berikut dibawah script jQuery yang baru saja anda copy :
<script type='text/javascript'>
//<![CDATA[

$(function(){

$('a[href*=#top]').click(function() {

if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {

var $target = $(this.hash);

$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

if ($target.length) {

var targetOffset = $target.offset().top;

$('html,body').animate({scrollTop: targetOffset}, 1000);

return false;

}

}

});

});
//]]>
</script>
<!-- end scrolltop -->
Kemudian cari kode <body>

Lalu ubah menjadi seperti ini  <body id='top'>  

Kemudian masukkan kode HTML dibawah ini tepat diatas kode </body>  
<div id='goingtop'>
<a href='#top' title='Top'><img src='http://masukkan alamat hosting gambar /goto_top.gif' style='right:20px; bottom:20px; position: fixed;'/></a></div>

sumber: Choen : deconstructioncode

2 komentar:

Denny mengatakan...

yang di pake ini ga di share ya :P

bocah gemblung mengatakan...

@ denny oblo : Insya Allah tak share...hehehehe..

Posting Komentar