diff --git a/modules/mixins/utils.js b/modules/mixins/utils.js index aab8a14b..315be466 100644 --- a/modules/mixins/utils.js +++ b/modules/mixins/utils.js @@ -24,8 +24,8 @@ const filterElementInContainer = (container) => (element) => container.contains const calculatingOffsetParent = (c, t) => t.offsetParent.isEqualNode(c) ? t.offsetTop : t.offsetTop + calculatingOffsetParent(c, t.offsetParent); -const scrollOffset = (c, t) => c === document ? - t.getBoundingClientRect().top + (window.scrollY || window.pageYOffset) : getComputedStyle(c).position !== 'static' ? calculatingOffsetParent(c, t) : calculatingOffsetParent(c.offsetParent, t.offsetParent) - c.offsetTop; +const scrollOffset = (c, t) => c === document || c === document.body || c === document.documentElement ? + t.getBoundingClientRect().top + (window.scrollY || window.pageYOffset) : getComputedStyle(c).position === 'static' ? calculatingOffsetParent(c.offsetParent, t.offsetParent) - c.offsetTop : calculatingOffsetParent(c, t); export default { pushHash,