mCustomScrollbar scrollButtons - scrolltype:" steps"

时间:2017-10-27 12:30:16

标签: jquery mobile scrollbar mcustomscrollbar

有没有人遇到设置" scrollButtons:{scrollType:"步进"}按钮不能在触摸设备上工作的问题? 代码:

$("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
});

1 个答案:

答案 0 :(得分:-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>