I have a div with scrollbars. How can I detect if someone mousedowns on the scrollbar?
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.
精彩评论