Detect click,mousedown,mouseup on scrollbar in Mozilla and/or Safari?

C

CodeMonkeySD

Hello:

I'm wondering if anyone knows a way that I can detect which piece of a
scrollbar was pressed?

In IE this is possible, but I'm not sure how to do it in Moz or other
browsers.
The onscroll event doesn't seem to have anything that I can find, and
the mousedown event doesn't fire (at least in firefox), when clicking
on a scrollbar.

I ask because I want to be able to know if the user is clicking on the
scrollbar thumb, scrollbar button, or in the scrollbar tray for pageup/
pagedown.
 
T

Thomas 'PointedEars' Lahn

CodeMonkeySD said:
I'm wondering if anyone knows a way that I can detect which piece of a
scrollbar was pressed?

Are you?
In IE this is possible,
How?

but I'm not sure how to do it in Moz or other browsers.

I see. That would depend on how you do it in IE.
The onscroll event doesn't seem to have anything that I can find, and
the mousedown event doesn't fire (at least in firefox), when clicking
on a scrollbar.
Correct.

I ask because I want to be able to know if the user is clicking on the
scrollbar thumb, scrollbar button, or in the scrollbar tray for pageup/
pagedown.

Why?


PointedEars
 
C

CodeMonkeySD

In IE you can say el.componentFromPoint(x,y) which will tell you where
the sb was clicked.

I'd go into why. . .but its complicated. . . basically i'm using a
virtual scrolling viewport and want to adjust the behavior according
to what was pressed.

Using the scrollTop/scrollLeft and the delta doesn't help me that much
b/c the delta varies so greatly and the events fire so differently in
different browsers.
 
T

Thomas 'PointedEars' Lahn

CodeMonkeySD said:
In IE you can say el.componentFromPoint(x,y) which will tell you where
the sb was clicked.

(<http://msdn.microsoft.com/en-us/library/ms536375(VS.85).aspx>)

Interesting, thanks.
I'd go into why. . .but its complicated. . . basically i'm using a
virtual scrolling viewport
^^^^^^^^^^^^^^^^^^^^^^^^^^
I am not sure I am familiar with that concept. Please elaborate.
and want to adjust the behavior according to what was pressed.

Using the scrollTop/scrollLeft and the delta doesn't help me that much
b/c the delta varies so greatly and the events fire so differently in
different browsers.

I still do not follow why it would matter to you how the scrolling was
triggered. Especially because scrolling does not need to be triggered by a
mouse click.

Anyhow, I do not see anything in the Gecko DOM that would allow an
unprivileged script to determine what you say you need. And there is no Web
standard for this either, so maybe you should reconsider your approach.

Please do not top-post, and do trim your quotes.

<http://jibbering.com/faq/#posting>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top