JS-function

与 JS 相关的函数

时间相关

正则相关

位置相关

获取元素相对于这个页面的 X 标

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* [获取元素相对于这个页面的X坐标]
* @param {[type]} elem [description]
* @return {[type]} [description]
*/
lin.pageX = function(argE) {
return argE.getBoundingClientRect().left + (document.documentElement.scrollLeft || document.body.scrollLeft);
};
/**
* [获取元素相对于这个页面的Y坐标]
* @param {[type]} argE [description]
* @return {[type]} [description]
*/
lin.pageY = function(argE) {
return argE.getBoundingClientRect().top + (document.documentElement.scrollTop || document.body.scrollTop);
};
打赏

请我喝杯咖啡吧~

支付宝
微信