jquery实现的鼠标下拉滚动置顶效果
$(function(){
//置顶按钮显示/隐藏实现
$(window).scroll(function(){
varw_height=$(window).height();//浏览器高度
varscroll_top=$(document).scrollTop();//滚动条到顶部的垂直高度
if(scroll_top>w_height){
$("#goto-top").fadeIn(500);
}else{
$("#goto-top").fadeOut(500);
}
});
//置顶
$("#goto-top").click(function(e){
e.preventDefault();
$(document.documentElement).animate({
scrollTop:0
},200);
//支持chrome
$(document.body).animate({
scrollTop:0
},200);
});
})
</script>
<styletype="text/css">
#goto-top{
display:none;
position:fixed;
width:38px;
height:36px;
background:url(images/goto-top.png)no-repeat00;
bottom:40px;
right:40px;
-webkit-transition:all0.2s;
-moz-transition:all0.2s;
-o-transition:all0.2s;
transition:all0.2s;
z-index:9999;
}
#goto-top:hover{
background:url(images/goto-top.png)no-repeat0-36px;
}
</style>
</head>热门推荐
7 简短的二胎祝福语
10 简短霸气女儿生日 祝福语
11 祝福语高考小众诗句简短
12 元旦祝福语20秒简短
13 老师过年祝福语大全 简短
14 一生祝福语简短
15 产检祝福语简短霸气
16 朋友店开张祝福语简短
17 生日爱情祝福语大全简短
18 朋友女儿生日祝福语 简短