$(function(){
$(window).scroll(function () {
if ($(this).scrollTop() > 500) {
$('#toTop').fadeIn();
} else {
$('#toTop').fadeOut();
}
});
$("#toTop").click(function(){
$("html,body").animate({scrollTop:0},"slow");
return false;
});
});
转自[url]http://aijuans.iteye.com/blog/1884591[/url]