Taken from element.getBoundingClientRect MDN documentation:
For cross-browser compatibility, use
window.pageXOffset
andwindow.pageYOffset
instead ofwindow.scrollX
andwindow.scrollY
, except use(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollLeft == 'number' ? t : document.body).ScrollLeft
and(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTop
whenwindow.pageXOffset
andwindow.pageYOffset
(andwindow.pageXOffset
andwindow.pageYOffset
) areundefined
.
Oye.