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

add back to top button #3

Open
llouison opened this issue May 6, 2017 · 0 comments
Open

add back to top button #3

llouison opened this issue May 6, 2017 · 0 comments

Comments

@llouison
Copy link
Owner

llouison commented May 6, 2017

couldn't get the scroll function to work in javascript

window.onscroll = function() {scrollFunction()};
let didScroll = false;

function scrollFunction() {
const topButton = document.getElementById('topButton');
if (document.body.scrollTop > 120 || document.documentElement.scrollTop > 120) {
topButton.style.display = 'block';
} else {
topButton.style.display = 'none';
}
}

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