How to capture scroll event on scrollbar (overflow:scroll div)?

If I do $(selector).on('mousewheel DOMMouseScroll', function (event) {} it captures mouse scroll but how to capture here mouse clicked on scrollbar and moved scroll event?

Putting it diffrently: how to caputre both mouse scroll and mouse click scroll events?

有帮助吗?

解决方案

Use the scroll event http://api.jquery.com/scroll/

As stated in the docs

A scroll event is sent whenever the element's scroll position changes, regardless of the cause. A mouse click or drag on the scroll bar, dragging inside the element, pressing the arrow keys, or using the mouse's scroll wheel could cause this event.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top