Custom CSS Scrollbar for Firefox

后端 未结 10 2378
遥遥无期
遥遥无期 2020-11-22 02:23

I want to customize a scrollbar with CSS.

I use this WebKit CSS code, which works well for Safari and Chrome:

::-webkit-scrollbar {
    width: 15px;
         


        
10条回答
  •  隐瞒了意图╮
    2020-11-22 02:58

    I thought I would share my findings in case someone is considering a JQuery plugin to do the job.

    I gave JQuery Custom Scrollbar a go. It's pretty fancy and does some smooth scrolling (with scrolling inertia) and has loads of parameters you can tweak, but it ended up being a bit too CPU intensive for me (and it adds a fair amount to the DOM).

    Now I'm giving Perfect Scrollbar a go. It's simple and lightweight (6KB) and it's doing a decent job so far. It's not CPU intensive at all (as far as I can tell) and adds very little to your DOM. It's only got a couple of parameters to tweak (wheelSpeed and wheelPropagation), but it's all I need and it handles updates to the scrolling content nicely (such as loading images).

    P.S. I did have a quick look at JScrollPane, but @simone is right, it's a bit dated now and a PITA.

提交回复
热议问题