简体   繁体   中英

Is there any way to manipulate scrollbar using javascript in Firefox?

I am writing a UserChromeJS script (If you don't know what UserChromeJS is, please take a look at http://userchromejs.mozdev.org/ )that turns the scrollbar into a floating one.

Link to my script: https://github.com/nightson/userChromeJS/blob/master/FloatingScrollbar.uc.js

What I want to do next is to make the scrollbar auto-hidden when not scrolling. But this is hard to achieve without being able to add/remove class to/from the scrollbar. I tried methods like querySelector and getAnonymousElementByAttribute without success. Could anyone help me?

ps: I don't want to hide the default scrollbar and create a new one, so please don't suggest solutions like jscrollpane.

What I want to do next is to make the scrollbar auto-hidden when not scrolling.

No, this has two issues:

  • The scrollbar will be hidden by default, since not scrolling is the default state
  • The onscroll event will never be triggered, since the scrollbar is hidden by default

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM