Skip to content
Snippets Groups Projects
Commit daa0e284 authored by HJ's avatar HJ :fire:
Browse files

forgotten file

parent ca92e294
No related branches found
No related tags found
2 merge requests!1028`master` refresh with `develop`,!895Emoji selector update
Pipeline #17577 failed
export const findOffset = (child, parent, { top = 0, left = 0 } = {}, ignorePadding = true) => {
const result = {
top: top + child.offsetTop,
left: left + child.offsetLeft
}
if (!ignorePadding && child !== window) {
const topPaddingStr = window.getComputedStyle(child)['padding-top']
const topPadding = Number(topPaddingStr.substring(0, topPaddingStr.length - 2))
const leftPaddingStr = window.getComputedStyle(child)['padding-left']
const leftPadding = Number(leftPaddingStr.substring(0, leftPaddingStr.length - 2))
result.top += ignorePadding ? 0 : topPadding
result.left += ignorePadding ? 0 : leftPadding
}
if (child.offsetParent && (parent === window || parent.contains(child.offsetParent))) {
return findOffset(child.offsetParent, parent, result, false)
} else {
return result
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment