开发者

Identify a scroll bar: Javascript

开发者 https://www.devze.com 2023-03-11 00:21 出处:网络
I\'m writing an extension to Firefox and I\'m using JavaScript. Everytime my mouse uses the scroll bar, my extension goes a little bit crazy.

I'm writing an extension to Firefox and I'm using JavaScript.

Everytime my mouse uses the scroll bar, my extension goes a little bit crazy.

I'd like to know if there's any way to identify t开发者_如何学Gohe mouse is on a scroll bar? Some kind of tag/method/special DOM property - anything!

Thanks.


Can you just check whether the mouse is hovering outside the borders of your page/container? Something like window.screen.width or similar?


Scroll bars are usually anonymous elements, they are added to HTML elements automatically but they aren't visible in the DOM. However, event.originalTarget will give you these scrollbar elements if they are the event target (see https://developer.mozilla.org/en/DOM/event.originalTarget).

0

精彩评论

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

关注公众号