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

Trigger SmoothState (redirect) on scroll #375

Open
RFlintstone opened this issue Apr 7, 2019 · 1 comment
Open

Trigger SmoothState (redirect) on scroll #375

RFlintstone opened this issue Apr 7, 2019 · 1 comment

Comments

@RFlintstone
Copy link

Is it possible to redirect a visitor to another page with smoothscroll (even if this is a external one such as https://github.com) when I scroll?

I currently detect if a user is scrolling with

window.addEventListener("wheel", myFunction);

function myFunction() { 
alert("You are scrolling");
}

Thanks in advance,
Ruben

@quadeinc
Copy link

Try this snippet of code:

window.addEventListener("wheel", myFunction);
function myFunction() { 
window.location.href = "http://github.com";
}

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