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

Change scrollIntoView functionality to support different block types #50

Open
vinamrasareen opened this issue Jan 29, 2025 · 0 comments

Comments

@vinamrasareen
Copy link

One of the steps needs to scroll to element and it does scroll to end but the highlight/backdrop is not displayed unless I resize browser or open/close inspect mode.

So instead of block: end as default, can we get to pass center or start

import {TourGuideClient} from "../Tour";

/**
 * scrollToTarget
 * @param tgInstance
 * @param targetElem
 */
const scrollToTarget = (tgInstance : TourGuideClient, targetElem : HTMLElement)=>{
    //TODO: detect when scroll complete instead of relying on timeout
    targetElem.scrollIntoView({behavior: tgInstance.options.autoScrollSmooth ? "smooth" : "auto", block: "end", inline: "nearest"});
}

export default scrollToTarget
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

1 participant