zoukankan      html  css  js  c++  java
  • 回到顶部的功能

     1     <a class="totop" id="to_top"></a>
     2 
     3 <script>
     4 /*回到顶部的功能*/
     5 window.onload = function(){
     6   var oTop = document.getElementById("to_top");
     7   var screenh = document.documentElement.clientHeight || document.body.clientHeight;
     8   oTop.style.top = screenh - oTop.offsetHeight + "px";
     9   window.onscroll = function(){
    10     var scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
    11     oTop.style.top = screenh - oTop.offsetHeight + scrolltop +"px";
    12   }
    13   oTop.onclick = function(){
    14     document.documentElement.scrollTop = document.body.scrollTop =0;
    15   }
    16 }  
    17 </script>
  • 相关阅读:
    最小生成树
    线段树
    编程快捷键
    线段树的动态开点
    常用库
    线性求逆元
    文件读入
    树上倍增(LCA)
    set容器
    快读与快写
  • 原文地址:https://www.cnblogs.com/clear93/p/5684133.html
Copyright © 2011-2022 走看看