![](/img/trans.png)
[英]mCustomScrollBar: Uncaught TypeError: $(…).mCustomScrollBar is not a function on window resize
[英]mCustomScrollbar scrollButtons - scrolltype: “stepped”
有沒有人遇到設置“ 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
});
您可以使用此代碼
<!-- 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.