commit: 4b050c7fa5e21f3f19c295d3e4b32f312651a213
parent 3d37b9d8e1cad78fb1f666b3cfb7f28b1fdc1c2d
Author: Henry Jameson <me@hjkos.com>
Date: Tue, 12 Apr 2022 21:49:14 +0300
properly ignore sticky elements when calculating offset because they
technically are following main scroll
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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) {