Hi,
I use this to get the position of a page element:
This works on all browsers except Chrome. Chrome seems to return a value also based on scroll position. Is this right? This because searching around, something like the above code is generally considered to be crossbrowser compatible. But I cannot find much information about this regarding Chrome.Code:var _x = 0; var _y = 0; while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) { _x += el.offsetLeft - el.scrollLeft; _y += el.offsetTop - el.scrollTop; el = el.offsetParent; }
Thanks!


Reply With Quote
Bookmarks