This commit is contained in:
Henry Jameson 2019-09-25 08:43:02 +03:00
parent 4f563e6efb
commit 0f55359b49
1 changed files with 5 additions and 3 deletions

View File

@ -13,9 +13,11 @@ export const findOffset = (child, parent, { top = 0, left = 0 } = {}, ignorePadd
if (child.offsetParent && (parent === window || parent.contains(child.offsetParent) || parent === child.offsetParent)) { if (child.offsetParent && (parent === window || parent.contains(child.offsetParent) || parent === child.offsetParent)) {
return findOffset(child.offsetParent, parent, result, false) return findOffset(child.offsetParent, parent, result, false)
} else { } else {
const { topPadding, leftPadding } = findPadding(parent) if (parent !== window) {
result.top += topPadding const { topPadding, leftPadding } = findPadding(parent)
result.left += leftPadding result.top += topPadding
result.left += leftPadding
}
return result return result
} }
} }