function getOffset(element) {
  var box = element.getBoundingClientRect();
  return {
    left: box.left + (window.pageXOffset - document.documentElement.clientLeft),
    top: box.top + (window.pageYOffset - document.documentElement.clientTop)
  };
}
function getOffset(element) {
  var box = element.getBoundingClientRect();
  return {
    left: box.left + (window.pageXOffset - document.documentElement.clientLeft),
    top: box.top + (window.pageYOffset - document.documentElement.clientTop)
  };
}
function getOffset ( element ) { var box = element . getBoundingClientRect ( ) ; return { left : box . left + ( window . pageXOffset - document . documentElement . clientLeft ) , top : box . top + ( window . pageYOffset - document . documentElement . clientTop ) } ; }
Get the offset base on the document.
@param {Element} element - The target element.
@returns {Object} The offset data.
Get the offset base on the document .