【问题标题】:PerfectScrollbar can't use wheel in bootstrap modalPerfectScrollbar 无法在引导模式中使用滚轮
【发布时间】:2019-12-20 07:00:50
【问题描述】:

使用 PerfectScrollbar 0.6.11,我无法让鼠标滚轮滚动模式中的元素。

这是一个小提琴:https://jsfiddle.net/9e64aspu/

$('#modal-filters').on('shown.bs.modal', function () {
      $('#filters-scroll').perfectScrollbar({
            suppressScrollY : true,
            handlers: ['click-rail', 'drag-scrollbar', 'wheel', 'touch'],
            wheelPropagation: true
     });
});

滚动条已显示,但我无法使用滚轮滚动。正常吗?

【问题讨论】:

    标签: jquery perfect-scrollbar


    【解决方案1】:

    你需要添加这个选项useBothWheelAxes: true

    你的 js 代码应该是这样的

    $(function() {
        $('#modal-filters').on('shown.bs.modal', function() {
            $('#filters-scroll').perfectScrollbar({
                suppressScrollY: true,
                theme: 'dark',
                handlers: ['click-rail', 'drag-scrollbar', 'wheel', 'touch'],
                wheelPropagation: true,
                useBothWheelAxes: true,
            });
        });
    });
    

    更新小提琴https://jsfiddle.net/5wkbszd3/3/

    【讨论】:

      猜你喜欢
      • 2020-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-29
      • 1970-01-01
      • 2021-08-01
      • 1970-01-01
      相关资源
      最近更新 更多