const childPos = obj.offset(); const parentPos = obj.parent().offset(); const childOffset = { top: childPos.top - parentPos.top, left: childPos.left - parentPos.left }