views:

139

answers:

1

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  A: 

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.

Gabriel
Good suggestion. The custom scroll bar implementation you linked to doesn't work in IE6 but fortunately there exists a plethora of custom scroll bar implementations, some of which I found listed at http://www.hiddenpixels.com/javascript/custom-javascript-scrollbar/.
Nathan
Yeah I did some more digging on this issue and I think unfortunately the different browsers just treat the scrollbar too differently for a single javascript direct event access script to be possible. In most cases I could not find any reference to exposing that part of the UI to the script or as part of the DOM.
Gabriel