JQuery toTop

 1    $(function () {
 2             $(window).scroll(function(){
 3                 if ($(window).scrollTop()>100){
 4                     $("#back-to-top").fadeIn(500);
 5                 }
 6                 else
 7                 {
 8                     $("#back-to-top").fadeOut(500);
 9                 }
10             });
11  
12             //当点击跳转链接后,回到页面顶部位置
13  
14             $("#back-to-top").click(function(){
15                 $('body,html').animate({scrollTop:0},300);         
16             });
17         });

 

posted on 2016-11-03 14:31  Mc525  阅读(117)  评论(0)    收藏  举报

导航