code: function _getOffsetSum(elem) {
      var top=0, left=0
      while(elem) {
          top = top + parseInt(elem.offsetTop)
          left = left + parseInt(elem.offsetLeft)
          elem = elem.offsetParent
      }
  
      return {top: top, left: left}
  }
docs: These three functions are used to get the element's offset,
  reference from http://javascript.info/tutorial/coordinates
  @param elem
  @returns {{top: number, left: number}}
  @private