Code:findPosX和findPosY
2023-06-13 09:13:47 时间
/**
* Find the X position of an object, relative to the viewport
* Code copied from quirksmode.org
* @param obj Object to find x position for
*/
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
/**
* Find the Y position of an object, relative to the viewport
* Code copied from quirksmode.org
* @param obj Object to find y position for
*/
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
* Find the X position of an object, relative to the viewport
* Code copied from quirksmode.org
* @param obj Object to find x position for
*/
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
/**
* Find the Y position of an object, relative to the viewport
* Code copied from quirksmode.org
* @param obj Object to find y position for
*/
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
相关文章
- VS code安装和使用技巧
- 解决 Visual Studio Code 在国内下载速度过慢的问题
- 《软件安装与使用教程》— Python语言常用开发工具Spyder、Pycharm、VS Code、Jupyter的使用「建议收藏」
- Helm as code
- SAP QM QS41 不能创建Catalog为Usage Decision的Code Group
- C++ 格雷码位置变化序列 Gray Code
- VS Code竟然能约会,找对象不看脸,看编程水平
- 另一种“推翻” VS Code 的尝试:JetBrains Fleet 现开放公测
- ORA-30184: argument type not compatible with a format code ORACLE 报错 故障修复 远程处理
- ORA-55378: invalid error code ORACLE 报错 故障修复 远程处理
- ORA-09854: snyPortInfo: bad return code from request. ORACLE 报错 故障修复 远程处理
- mysql error code 1153:Got a packet bigger than ‘max_allowed_packet’详解数据库
- 比较 VS Code 与 SQL Server 的性能(vssqlserver)
- 使用 VS Code 进行 Python 编程
- Android Studio源码扫描工具:Code Arbiter