Is it possible to capture mouse events on a scroll

2019-08-09 22:03发布

问题:

I have an HTML element with overflow: scroll. The click event listener registered with the element is triggered when I click on the element, but not when I click on the scroll bar for the element. Is it possible to capture mouse events which occur on an HTML element's scroll bar?

The reason I want to do this is to make a visual popup element disappear when ever a click event occurs anywhere outside the popup element.

回答1:

you can style away the standard scroll bar and place your own, which would allow you the control you seek. http://livepipe.net/control/scrollbar might help.