How to hide scrollbar in Firefox?

前端 未结 14 640
攒了一身酷
攒了一身酷 2020-11-29 04:33

I just found out how to hide the scrollbar in Google Chrome, I did it with this code:

::-webkit-scrollbar { display: none; }

The only p

相关标签:
14条回答
  • 2020-11-29 05:02

    I was able to hide the scrollbar but still be able to scroll with mouse wheel with this solution:

    html {overflow: -moz-scrollbars-none;}
    

    Download the plugin https://github.com/brandonaaron/jquery-mousewheel and include this function:

    jQuery('html,body').bind('mousewheel', function(event) {
        event.preventDefault();
        var scrollTop = this.scrollTop;
        this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -1));
        //console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta);
      });
    
    0 讨论(0)
  • 2020-11-29 05:07

    You can use the scrollbar-width rule. You can scrollbar-width: none; to hide the scrollbar in Firefox and still be able to scroll freely.

    body {
       scrollbar-width: none;
    }
    
    0 讨论(0)
提交回复
热议问题