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

首頁 > 編程 > JavaScript > 正文

Code:findPosX 和 findPosY

2019-11-21 02:25:31
字體:
供稿:網(wǎng)友
/**
 * 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;
}
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 太白县| 仁怀市| 巫山县| 吉安市| 十堰市| 宁乡县| 林州市| 五家渠市| 云阳县| 乌拉特后旗| 玛曲县| 淮滨县| 尖扎县| 五河县| 定南县| 南安市| 南昌市| 茶陵县| 永靖县| 沭阳县| 沙田区| 龙里县| 清河县| 水城县| 长武县| 英吉沙县| 台中市| 林西县| 恩施市| 嘉鱼县| 灯塔市| 滁州市| 卫辉市| 高邮市| 莎车县| 蒙山县| 盈江县| 安平县| 临海市| 昌江| 鲁甸县|