解决滚动条定位

来源:互联网 发布:java初级工程师工资 编辑:程序博客网 时间:2024/04/30 11:51

js中获取当前位置:

function ScollPostion() {

       var t,l;
       if (document.documentElement && document.documentElement.scrollTop) {
       t = document.documentElement.scrollTop;
       l = document. documentElement.scrollLeft;
       } else if (document.body) {
       t = document.body.scrollTop;
       l = document.body.scrollLeft;
       }
       document.getElementById("scrollTop").value=t;

        }

js中定位当前位置:

function queryPosition(){
   var  t=Number("${scrollTop}");
   window.scrollTo(0,t);
   }

1 0
原创粉丝点击