diff options
-rw-r--r-- | itjs/it.js | 22 |
1 files changed, 2 insertions, 20 deletions
@@ -178,30 +178,12 @@ function it_event_void(evt) /* Get object pixel position. Based on quirksmode.org's code */ function it_get_obj_x(obj) { - var curleft = 0; - if (obj.offsetParent) - while (obj) - { - curleft += obj.offsetLeft; - obj = obj.offsetParent; - } - else if (obj.x) - curleft += obj.x; - return curleft; + return obj.getBoundingClientRect().left + ((window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft); } function it_get_obj_y(obj) { - var curtop = 0; - if (obj.offsetParent) - while (obj) - { - curtop += obj.offsetTop; - obj = obj.offsetParent; - } - else if (obj.y) - curtop += obj.y; - return curtop; + return obj.getBoundingClientRect().top + ((window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop); } /* Common accessor for dom elements */ |