Skip to content

Scrolling doesnt work correctly in Sidebar #1051

Closed Answered by gilbarbara
BennyAlex asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @BennyAlex

So, to start, the body is shorter than the sidebar, which is weird. Set a min-height: 100vh to fix that.
But even the minHeight, the sidebar scrolls too when the Joyride is scrolling, which causes the spotlight to be rendered in the wrong position.
I could fix it by dispatching a resize event when all the scrolling ends. I'm not sure if there's a better option, but it works.

Add this function somewhere in your code:

function waitForScrollEnd() {
  let lastChangedFrame = 0;
  let lastX = window.scrollX;
  let lastY = window.scrollY;

  return new Promise<void>((resolve) => {
    function tick(frames: number) {
      if (frames >= 500 || frames - lastChangedFrame > 20) {

Replies: 4 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@BennyAlex
Comment options

Comment options

You must be logged in to vote
6 replies
@gilbarbara
Comment options

@BennyAlex
Comment options

@BennyAlex
Comment options

@gilbarbara
Comment options

@BennyAlex
Comment options

Answer selected by gilbarbara
Comment options

You must be logged in to vote
2 replies
@BennyAlex
Comment options

@BennyAlex
Comment options

Comment options

You must be logged in to vote
2 replies
@BennyAlex
Comment options

@gilbarbara
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants