function offset(el) {
    var x = el.offsetLeft,
        y = el.offsetTop
    if (el.offsetParent) {
      var parentOffset = offset(el.offsetParent)
      x += parentOffset.x
      y += parentOffset.y
    }
    return {
      x: x,
      y: y
    }
  }
// get top and left to document
get top and left to document
get top and left to document
function offset(el) {
    var x = el.offsetLeft,
        y = el.offsetTop
    if (el.offsetParent) {
      var parentOffset = offset(el.offsetParent)
      x += parentOffset.x
      y += parentOffset.y
    }
    return {
      x: x,
      y: y
    }
  }
function offset ( el ) { var x = el . offsetLeft , y = el . offsetTop if ( el . offsetParent ) { var parentOffset = offset ( el . offsetParent ) x += parentOffset . x y += parentOffset . y } return { x : x , y : y } }
get top and left to document
get top and left to document