Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll to a step isn't working when "placement: auto" #738

Open
pierreonthenet opened this issue May 7, 2020 · 1 comment
Open

Scroll to a step isn't working when "placement: auto" #738

pierreonthenet opened this issue May 7, 2020 · 1 comment

Comments

@pierreonthenet
Copy link

When placement of a step is set to "auto", the scroll to this step won't work : we need to set it to top, bottom, left or right.
If "auto" is set, then it will scroll to 0 (the top of page).

Here is the code in Tour.prototype._scrollIntoView (v0.12.0) :

      scrollTop = 0;
      switch (step.placement) {
        case 'top':
          scrollTop = Math.max(0, offsetTop - (windowHeight / 2));
          break;
        case 'left':
        case 'right':
          scrollTop = Math.max(0, (offsetTop + height / 2) - (windowHeight / 2));
          break;
        case 'bottom':
          scrollTop = Math.max(0, (offsetTop + height) - (windowHeight / 2));
      }
      this._debug("Scroll into view. ScrollTop: " + scrollTop + ". Element offset: " + offsetTop + ". Window height: " + windowHeight + ".");
@MrLewk
Copy link

MrLewk commented Jul 13, 2021

Just came across this issue, as it's been bugging me for days now. Hopefully a fix can be put in as anything I've tried has failed so far :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants