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