How to detect if the page is scrolling down or up?

Asked

Viewed 53 times

2

I would like to know how to do this, in javascript. It would be for a menu fixed at the top. It would appear when rolling the body up, and disappear when rolling down, but need to detect the direction of the scroll with js.

Is there any function (generic or native) so I can detect this?

If it’s no bother, I’d like it to be in pure JS, without jQuery or something like.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.