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 Waypoint? #610

Open
tacman opened this issue Dec 16, 2019 · 0 comments
Open

Scroll to Waypoint? #610

tacman opened this issue Dec 16, 2019 · 0 comments

Comments

@tacman
Copy link

tacman commented Dec 16, 2019

Thanks, Caleb, for putting this library together, it's really great.

How can I programmatically scroll to a waypoint? I'm highlighting the text in the middle of the screen

$('.waypoint').each(function(index, element) {
    const waypoint = new Waypoint({
        element: element,
        offset: '50%', 
        handler: (e) => {
            let $el = $(this);
            let text = $el.first();
            $('.expand').removeClass('expand');

            // get the text span (dialogue) element
            let $dialogElement = $el.find('.dialogue-text').addClass('expand');
        });
});

I've been trying to use the jquery-scrollto plugin, but running into issues with webpack, so figured I'd ask here just in case there's an easy way to do it. You've obviously done a lot of work with the scrolling and positioning events.

Thanks.

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