源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Code:findPosX 和 findPosY

  • 时间:2021-04-22 02:05 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Code:findPosX 和 findPosY
/**  * 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; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部