Taken from element.getBoundingClientRect MDN documentation:
For cross-browser compatibility, use
window.pageXOffsetandwindow.pageYOffsetinstead ofwindow.scrollXandwindow.scrollY, except use(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollLeft == 'number' ? t : document.body).ScrollLeftand(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTopwhenwindow.pageXOffsetandwindow.pageYOffset(andwindow.pageXOffsetandwindow.pageYOffset) areundefined.
Oye.