【问题标题】:mCustomScrollbar scrollButtons - scrolltype: "stepped"mCustomScrollbar 滚动按钮 - 滚动类型:“步进”
【发布时间】:2018-04-09 01:26:54
【问题描述】:

有没有人遇到过设置“scrollButtons: {scrollType: "stepped"} 按钮在触控设备上不起作用的问题? 代码:

$("container").mCustomScrollbar({
    setHeight: false,
    autoExpandScrollbar:true,
    snapAmount: height,
    mouseWheel: {
        enable: false,
        scrollAmount: height,
        normalizeDelta:true
    },
    keyboard: {
        enable: false,
        scrollAmount: height
    },
    scrollButtons: {
        enable: true,
        scrollAmount: 1,
        scrollType: "stepped"
    },
    advanced: {
        updateOnContentResize: true
    },
    scrollInertia: 1,
    contentTouchScroll: 10000,
    documentTouchScroll: false
});

【问题讨论】:

  • 您使用的是哪个版本的 mCustomScrollbar.js?
  • @Jinesh 3.1.5(最新)

标签: jquery mobile scrollbar mcustomscrollbar


【解决方案1】:

你可以使用这个代码

<!-- custom scrollbar script -->
<script src="/path/to/jquery.mCustomScrollbar.js"></script>
<!-- detect mobile script -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.3.5/mobile-detect.min.js"></script>
<!-- custom scrollbar function call -->
<script>
    (function($){
        var md=new MobileDetect(window.navigator.userAgent); //get device type
        $(window).load(function(){
            if(!md.mobile()){ //apply custom scrollbar if device is not mobile
                $(selector).mCustomScrollbar();
            }
        });
    })(jQuery);
</script>

【讨论】:

  • 明白,不过我要mCustomScrollbar@touch device:)
  • 你能分享你的网址吗?
猜你喜欢
  • 2016-12-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-11
  • 2017-04-04
相关资源
最近更新 更多