aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-04-12 21:49:14 +0300
committerHenry Jameson <me@hjkos.com>2022-04-12 21:49:14 +0300
commit4b050c7fa5e21f3f19c295d3e4b32f312651a213 (patch)
tree8bcd68d34516b0349aa601f03efe03db2676a398
parent3d37b9d8e1cad78fb1f666b3cfb7f28b1fdc1c2d (diff)
properly ignore sticky elements when calculating offset because they
technically are following main scroll
-rw-r--r--src/services/offset_finder/offset_finder.service.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/services/offset_finder/offset_finder.service.js b/src/services/offset_finder/offset_finder.service.js
index 9034f8c8..5a904f08 100644
--- a/src/services/offset_finder/offset_finder.service.js
+++ b/src/services/offset_finder/offset_finder.service.js
@@ -9,7 +9,7 @@ export const findOffset = (child, parent, { top = 0, left = 0 } = {}, ignorePadd
result.left += ignorePadding ? 0 : leftPadding
}
- if (child.offsetParent && (parent === window || parent.contains(child.offsetParent) || parent === child.offsetParent)) {
+ if (child.offsetParent && window.getComputedStyle(child.offsetParent).position !== 'sticky' && (parent === window || parent.contains(child.offsetParent) || parent === child.offsetParent)) {
return findOffset(child.offsetParent, parent, result, false)
} else {
if (parent !== window) {