开发者

I have a div with scrollbars. How can I detect if someone mousedowns on the scrollbar?

开发者 https://www.devze.com 2023-01-27 17:07 出处:网络
I have a div with scrollbars. How can I detect if someone 开发者_StackOverflow中文版mousedowns on the scrollbar?You can use the jQuery scroll function .scroll() and pass it a function to be called whe

I have a div with scrollbars. How can I detect if someone 开发者_StackOverflow中文版mousedowns on the scrollbar?


You can use the jQuery scroll function .scroll() and pass it a function to be called when scrolling occurs. See here for more info.

Example:

$('#targetdiv').scroll(function(event) {
  //Stuff to do when scrolled
});

You then might be able to use the event data to see if a mouse button is pressed.


You can use the scroll event. jQuery also has a scroll convenience function.

I'm not sure if you can detect the scroll direction.


I dont think you can. But I believe you can bind something to the scroll event of the div that will trigger when the div actually has it's content's scroll position changed.

0

精彩评论

暂无评论...
验证码 换一张
取 消