手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery实现的鼠标下拉滚动置顶效果
jquery实现的鼠标下拉滚动置顶效果
摘要:$(function(){//置顶按钮显示/隐藏实现$(window).scroll(function(){varw_height=$(wi...

$(function(){ //置顶按钮显示/隐藏实现 $(window).scroll(function(){ var w_height = $(window).height();//浏览器高度 var scroll_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> <style type="text/css"> #goto-top { display:none; position:fixed; width:38px; height:36px; background:url(images/goto-top.png) no-repeat 0 0; bottom:40px; right:40px; -webkit-transition:all 0.2s; -moz-transition:all 0.2s; -o-transition:all 0.2s; transition:all 0.2s; z-index:9999; } #goto-top:hover { background:url(images/goto-top.png) no-repeat 0 -36px; } </style> </head>

【jquery实现的鼠标下拉滚动置顶效果】相关文章:

jQuery实现返回顶部功能

js实现鼠标划过给div加透明度的方法

JS实现模拟风力的雪花飘落效果

jQuery实现的多屏图像图层切换效果实例

js实现仿Windows风格选项卡和按钮效果

JQuery实现带排序功能的权限选择实例

js实现鼠标经过表格行变色的方法

jquery滚动特效集锦

jQuery实现转动随机数抽奖效果的方法

JS实现窗口加载时模拟鼠标移动的方法

精品推荐
分类导航