javascripthtmlcssreactjsnicescroll

nicescroll.js - how to disable vertical scrollbar?


I use jquery-nicescroll:

$(this.refs.container).niceScroll({
  cursorcolor: '#f16221',
  cursorwidth: '14',
  cursorminheight: '64',
  scrollspeed: '50',
  autohidemode: 'false',
  overflowy: 'false'
})

Currently it has both scrollbars: vertical and horizontal. I need to hide/disable vertical scrollbar but haven't found a solution. I have tried adding overflowy: 'false' but it didn't work. There is horizrailenabled: false which works well but there is no option for vertical.

Similar question: Disable Vertical Scroll in niceScroll Js

How to hide vertical scrollbar using nicescroll?


Solution

  • I suggest to add the below jQuery code for a complete solution, to disable and hide the vertical scrollbar:

    var nice = 
        $(this.refs.container).niceScroll({
            cursorcolor: '#f16221',
            cursorwidth: '14',
            cursorminheight: '64', 
            scrollspeed: '50',
            autohidemode: 'false',
            overflowy: 'false'
        });
    
    var _super = nice.getContentSize;
    
    nice.getContentSize = function () {
        var page = _super.call(nice);
        page.h = nice.win.height();
        return page;
    }
    
    $('.nicescroll-rails.nicescroll-rails-vr').remove();
    

    (partially mentioned on https://code.google.com/archive/p/jquery-nicescroll/issues/27)