Live2D

JQuery返回顶部

为了兼容谷歌和火狐,body和html都要写(这是个坑)

  $(".go-top").on('click',function(){
      $('body,html').animate({scrollTop: 0},1000)
  })
  //滑动到指定位置,开始显示图标
  $(window).scroll(function(){
      var top=$(this).scrollTop();
      if(top>200){
          $(".go-top").fadeIn();
      }else{
          $(".go-top").fadeOut();
      }
  })

 

posted @ 2018-06-13 10:50  webmtjj  阅读(109)  评论(0)    收藏  举报