Jquery Back to Top // Tuesday, July 26, 2011
Assalamu'alaikum...
Lettha mau bikin tutorial pertama Lettha di blog ini nih. Namanya "Jquery Back to Top" nanti scroll to top nya keluar samar samar gitu. kalau penasaran, silakan langsung dicoba saja yah :D
Dashboard >>Design >>Edit HTML
Cari kode:
</body>
Pastekan kode ini dibawah kode tadi:
<a href='#' id='toTop'><img src='URL IMAGE TOP BUTTON?t=1292762029' style='border:0;'/></a>Merah diganti dengan URL button back to top kamu. Lettha punya banyak koleksi, click DISINI
Cari kode:
]]></b:skin>
Pastekan kode ini diatas kode ]]></b:skin> :
/* to top */Kalau icon TOP anda terpotong, silakan ubah size yang warna Biru tersebut sampai icon top anda utuh :D
#toTop { width:100px;background:none;border:0px solid #ccc;text-align:center;padding:5px;position:fixed;bottom:10px;right:10px;cursor:pointer;color:#666;text-decoration:none; }
Cari kode ini lagii:
</head>
Pastekan kode ini diatasnya:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
/*-----------------------
* jQuery Plugin: Scroll to Top
* by Letthalicious Blog (http://letthaprincess.blogspot.com/)
* Bring to you by Thata from http://lettha-story.blogspot.com/
* Copyright (c) 2011 Letthalicious Blog
* Description: Adds an unobtrusive "Scroll to Top" link to your page with smooth scrolling.
* For usage instructions and version updates to go http://letthaprincess.blogspot.com/
* Do not delete these infomation
* Version: 1.0, 12/03/2009
-----------------------*/
$(function(){$.fn.scrollToTop=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="0"){$(this).fadeIn("slow")}var scrollDiv=$(this);$(window).scroll(function(){if($(window).scrollTop()=="0"){$(scrollDiv).fadeOut("slow")}else{$(scrollDiv).fadeIn("slow")}});$(this).click(function(){$("html, body").animate({scrollTop:0},"slow")})}});
$(function() {
$("#toTop").scrollToTop();
});
</script>
PREVIEW DULU !!! Kalau puas, click Save Tempelate :)