nicescroll.js - how to disable vertical scrollbar?

与世无争的帅哥 提交于 2019-12-11 17:54:35

问题


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?


回答1:


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)



来源:https://stackoverflow.com/questions/51307189/nicescroll-js-how-to-disable-vertical-scrollbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!