alicelieutier/smoothScroll

multiple issues when context isn't window

Closed this issue · 3 comments

  • scroll jumps to 0 then animates to end position (this is because window.pageYOffset is used even when context !== window
  • scroll end position is often incorrect, e.g. when context.scrollTop !== 0
  • smooth scrolling to the end doesn't ease out in some cases. Solution: clamp the end position to context.scrollHeight - context.offsetHeight

These issues are fixed in my PR #20

I'd also like to see this fixed. As well as support for horizontal scrolling.

Tried 0.2.2 with webpack and noticed an error. My guess is, this issue is also related to not setting the context correctly in the library

Error:

/js/smoothscroll.js:27
ent.querySelectorAll === void 0 || window.pageYOffset === void 0 || history.pu
                                                                    ^
ReferenceError: history is not defined
aabbi commented

facing the same issue as @dennismphil