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.
OnScroll only when moved by mouse or mousewheel
in JavaScript
Posted
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.