我使用了选项autoScrollingMode:"always“,但当用户将鼠标移到左侧或右侧热点上或使用鼠标滚轮时,autoScrolling仍然会停止。与描述相反,热点未被禁用。我怎样才能在不停止的情况下自动滚动。这是我的代码:
<script type="text/javascript">
$(document).ready(function() {
$("#makeMeScrollable").smoothDivScroll({
mousewheelScrolling: true,
manualContinuousScrolling: true,
visibleHotSpotBackgrounds: "onstart",
autoScrollingMode: "always",
hotSpotScrollingStep: "5",
hotSpotsVisibleTime: "2000"
});
});
</script>谢谢你的帮助,Afrikpit
发布于 2012-09-28 18:00:06
如果你想要自动滚动,这个设置应该足够了:
<script type="text/javascript">
$(document).ready(function() {
$("#makeMeScrollable").smoothDivScroll({
autoScrollingMode: "always"
});
});
</script>这意味着滚动条将一直自动滚动,而不会受到用户的干扰。或者,您是否在寻找不同的设置?
发布于 2013-08-30 00:05:18
使用autoScrollingMode:"onStart“
发布于 2013-10-27 02:03:29
好了,我已经修复了它在我的源码编辑了一点,以禁用鼠标滚轮滚动。
在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
});
});https://stackoverflow.com/questions/10664674
复制相似问题