我结合了select2和jQuery自定义内容滚动库来获得一个很好的功能性下拉列表但由于某些原因我不能使它在鼠标滚轮上工作。
这里有一个用于加载组件的简单代码,我尝试了不同的方法以及内置选项但到目前为止没有运气
$('#testDropdown').select2();
$("span.select2-selection").on("click", function () {
$(".select2-results").toggleClass("mCustomScrollbar").attr('data-mcs-theme', 'gray-theme');
$(".select2-results").mCustomScrollbar("destroy");
$(".select2-results").mCustomScrollbar({
advanced: {
updateOnContentResize: true
},
live: true,
mouseWheel:true,
scrollInertia: 500
});
});
任何指针都会受到赞赏