码迷,mamicode.com
首页 > Web开发 > 详细

js-获取滚动条位置

时间:2016-08-27 19:15:15      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:

function ScollPostion() {
var t, l, w, h;
if (document.documentElement && document.documentElement.scrollTop) {
t = document.documentElement.scrollTop;
l = document.documentElement.scrollLeft;
w = document.documentElement.scrollWidth;
h = document.documentElement.scrollHeight;
} else if (document.body) {
t = document.body.scrollTop;
l = document.body.scrollLeft;
w = document.body.scrollWidth;
h = document.body.scrollHeight;
}
return {
top: t,
left: l,
width: w,
height: h
};
}

js-获取滚动条位置

标签:

原文地址:http://www.cnblogs.com/ban-s/p/js-scroll-coordinate.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!