1 Code thanh trược lên xuống tuyệt đẹp Tue Nov 13, 2012 8:18 am
Admin
Trùm Forum
chèn vào fooder
- Code:
<script type='text/javascript'>var sheight = $(window).height();var maxheight = $("body").height();$(function(){$.fn.scrollToMiddle=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="maxheight/2-sheight/2"){$(this).fadeIn("slow")}var scrollDiv=$(this);$(window).scroll(function(){if($(window).scrollTop()=="maxheight/2-sheight/2"){$(scrollDiv).fadeOut("slow")}else{$(scrollDiv).fadeIn("slow")}});$(this).click(function(){$("html, body").animate({scrollTop:maxheight/2-sheight/2},"slow")})}});$(function(){$.fn.scrollToBottom=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="maxheight"){$(this).fadeIn("slow")}var scrollDiv=$(this);$(window).scroll(function(){if($(window).scrollTop()=="maxheight"){$(scrollDiv).fadeOut("slow")}else{$(scrollDiv).fadeIn("slow")}});$(this).click(function(){$("html, body").animate({scrollTop:maxheight},"slow")})}});$(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() {$("#toMiddle").scrollToMiddle();$("#toTop").scrollToTop();$("#toBottom").scrollToBottom();});</script>
<div style="bottom: 25px;clip: inherit;position: fixed;right: 5px;"><a href="#" id="toTop"><img alt="Đầu trang" border="0" src="http://r22.imgfast.net/users/2211/12/43/96/album/top10.png"></a><br><a href="#" id="toMiddle"><img alt="Giữa trang" border="0" src="http://r22.imgfast.net/users/2211/12/43/96/album/middle10.png"></a><br><a href="#" id="toBottom"><img alt="Cuối trang" border="0" src="http://r22.imgfast.net/users/2211/12/43/96/album/bottom10.png"></a></div></div>