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

H.redirect always refresh page #118

Open
Rinmawia opened this issue Mar 12, 2023 · 1 comment
Open

H.redirect always refresh page #118

Rinmawia opened this issue Mar 12, 2023 · 1 comment

Comments

@Rinmawia
Copy link

I have a code that use gsap scroll trigger to call the H.redirect() when scroll to that element. But instead of transitioning the page, it hard redirect to the destination page.

... ScrollTrigger.create({ ... onEnter: () => { H.redirect('dest', 'myTransitionKey') } ... })

@stefbowerman
Copy link

I ran into the same problem - it's related to this line where it compares location.origin of the passed in url vs the url of the current page.

It can be fixed by explicitly passing the origin like:

... ScrollTrigger.create({ ... onEnter: () => { H.redirect(`${window.location.origin}/dest`, 'myTransitionKey') } ... })

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