国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > JS > 正文

Code:findPosX 和 findPosY

2024-09-06 12:44:15
字體:
來源:轉載
供稿:網友
/**
 * 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;
}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 忻州市| 光泽县| 舟曲县| 荣昌县| 大化| 孟州市| 刚察县| 洪江市| 高邑县| 故城县| 南京市| 烟台市| 岳阳县| 蒙山县| 石嘴山市| 五河县| 苏尼特右旗| 遂平县| 孝义市| 高邑县| 泉州市| 茂名市| 宁武县| 福鼎市| 禄丰县| 贡嘎县| 法库县| 达孜县| 曲阜市| 巩义市| 泸溪县| 潢川县| 枣庄市| 深水埗区| 浪卡子县| 龙游县| 安陆市| 潍坊市| 木兰县| 三门峡市| 祁东县|