好的,我已经通过稍微编辑源以禁用鼠标滚轮滚动来修复它。
在 jquery.smoothDivScroll.js(不是 .min.js)的第 337-355 行,我注释掉了所有的self.stopAutoScrolling();
和self.move(pixels);
行:
if (o.mousewheelScrolling === "vertical" && deltaY !== 0) {
// Stop any ongoing auto scrolling if it's running
// self.stopAutoScrolling();
event.preventDefault();
// pixels = Math.round((o.mousewheelScrollingStep * deltaY) * -1);
// self.move(pixels);
} else if (o.mousewheelScrolling === "horizontal" && deltaX !== 0) {
// Stop any ongoing auto scrolling if it's running
// self.stopAutoScrolling();
event.preventDefault();
// pixels = Math.round((o.mousewheelScrollingStep * deltaX) * -1);
// self.move(pixels);
} else if (o.mousewheelScrolling === "allDirections") {
// Stop any ongoing auto scrolling if it's running
// self.stopAutoScrolling();
event.preventDefault();
// pixels = Math.round((o.mousewheelScrollingStep * delta) * -1);
// self.move(pixels);
}
然后我将第 364 行更改为:
el.data("scrollingHotSpotLeft").add(el.data("scrollingHotSpotRight")).add(el.data("scrollWrapper")).mousewheel(function (event) {
我刚刚添加了.add(el.data("scrollWrapper"))
部分以禁用整个区域的鼠标滚轮滚动。
这样做使它滚动得更快一些,所以我不得不调整我的autoScrollingInterval
设置,但它似乎无论如何都禁用了鼠标滚轮滚动。顶部的默认设置是禁用热点滚动的良好开端(我在 jquery.smoothDivScroll.js 顶部的选项中默认禁用它并且看不到任何热点)。
然后只需将代码压缩回您的 jquery.smoothDivScroll.min.js 文件,您就应该进行设置。最后我的配置看起来像这样:
$(document).ready(function() {
$("div#makeMeScrollable").smoothDivScroll({
manualContinuousScrolling: true,
autoScrollingMode: "always",
autoScrollingInterval: 80,
autoScrollingDirection: "endlessLoopRight",
autoScrollingStep: 1,
hotSpotScrolling: false,
mousewheelScrolling: "",
touchScrolling: false
});
});