【发布时间】:2020-01-04 06:07:47
【问题描述】:
我对“双滚动”有疑问;这是我的应用程序的屏幕:
如您所见,添加表格的空间被滚动条包围。 我只需要滚动功能来放大和缩小图表,而不是上下移动它。目前的情况是,如果我运行放大和缩小图表的函数,它也会向上或向下滚动。这样的双卷轴毫无意义。
是否可以只关闭“滚动”功能而不关闭侧面的滚动条?
这是一些代码(我的事件轮)(我正在使用库“MindFusion Diagramming”):
document.addEventListener('wheel', function (e) {
var zoom = diagram.getZoomFactor();
zoom -= e.deltaY / 35;
if(zoom > 70 && zoom < 200 )
{
diagram.setZoomFactor(zoom);
}
//e.preventDefault();
});
当我取消注释 e.preventDefault () 时,这是一个错误
我的 div(内容是带有滚动条的区域):
<div id="content" style="position: static; width: 1600px; height: 700px;" >
<!-- The Overview component is bound to the canvas element below -->
<div style="position: absolute; right: 120px; width: 200px;
height: 200px; border: 1px solid #ffffff; background-color: #c0c0c0;">
<canvas id="overview" width="200" height="200">
</canvas>
</div>
<!-- The Diagram component is bound to the canvas element below -->
<div style="position: static; width: 100%; height: 100%; overflow: auto;">
<canvas id="diagram" width="2100" height="2100">
This page requires a browser that supports HTML 5 Canvas element.
</canvas>
</div>
</div>
【问题讨论】:
-
取消注释
e.preventDefault()并将其放在函数定义的顶部。 -
什么都没有改变,我仍然有同样的错误
标签: javascript jquery html css