Jonathan2 Posted May 3, 2019 Share Posted May 3, 2019 Hello, Im using a script to scroll the scrollbar on browser resize. If there is no scrollbar and it is resized until there is a scrollbar it will be centered so I use a calculation like this: scrollbar length / scroll bar divider When it is centered the divider is 2. Now I want to remember the relative scrollbar position when scrolling, for this I calculate the scroll bar divider onscroll, but the event also fires when the resize script is called. I somehow only want the onscroll script to fire when the scrollbar is used by mouse or mousewheel. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 3, 2019 Share Posted May 3, 2019 There's a wheel event: https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event You may also want to consider using the arrow keys to scroll, and just grabbing the scrollbar and moving it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now