回到顶部

<script type="text/javascript">
  jQuery.noConflict();
  jQuery(function(){
  //首先将#back-to-top隐藏
  jQuery("#totop").hide();
  //当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失
  jQuery(function () {
  jQuery(window).scroll(function(){
  if (jQuery(window).scrollTop()>100){
  jQuery("#totop").fadeIn();
  }
  else
  {
  jQuery("#totop").fadeOut();
  }
  });
  //当点击跳转链接后,回到页面顶部位置
  jQuery("#totop").click(function(){
  jQuery('body,html').animate({scrollTop:0},500);
  return false;
  });
  });
  });
  </script>

 

#share a {
  1. width: 50px;
  2. height: 50px;
  3. position: fixed;
  4. left: 50%;
  5. margin-left: 580px;
  6. cursor: pointer;
  7. bottom: 67px;
  8. text-indent: -9999px;
  9. display: block;
  10. border: 0;
  11. transition: all 0s ease 0s;
  12. background: url(../../template/win8mi_10th_os/src/top.png) no-repeat 0 0;
}
 
  <div id="share">
  <a id="totop" title="">返回顶部</a>
  </div>

 

posted on   liuwenbohhh  阅读(183)  评论(0编辑  收藏  举报

努力加载评论中...
点击右上角即可分享
微信分享提示