当屏幕尺寸达到992px或更小尺寸时,我需要禁用NiceScroll插件,因为它使我难以触摸链接,从而使我在移动设备上的菜单混乱。我是javascript和jQuery的新手,因此感谢您的帮助。
$(function() {
var largeScreen = false;
$(document).ready(function() {
if ($(window).width() > 992) {
largeScreen = true;
}
});
$(window).resize(function() {
if ($(window).width() > 992) {
largeScreen = true;
} else {
largeScreen = false;
}
});
function doSomething() {
if (largeScreen) {
$("body").niceScroll({
cursorcolor: "#1f3677",
cursorborder: "2px solid #E8E8E8",
cursorwidth: "10px",
cursorfixedheight: 200,
railpadding: {
top: 0,
right: 5,
left: 0,
bottom: 0
},
zIndex: 1,
//emulatetouch: true,
cursordragontouch: false,
disableoutline: true,
enablekeyboard: true,
enableobserver: true,
});
$(".calendar-info").niceScroll({
cursorcolor: "#1f3677",
cursorborder: "1px solid #E8E8E8",
cursorwidth: "5px",
cursorfixedheight: 200,
railpadding: {
top: 0,
right: 2,
left: 0,
bottom: 0
},
autohidemode: false,
//emulatetouch: true,
disableoutline: true,
});
}
}
});