此构造允许用户在 html5 Canvas 上绘图。在其他浏览器(例如移动版 Safari 和 Chrome)上,.preventDefault()
和 .stopPropagation()
成功取消在 Canvas 上移动手指时的任何滚动。然而移动端 IE 仍然滚动,导致无法绘制。
有什么办法可以取消滚动吗?
startDrawing: function(e) {
var me = this;
if (!me.isLocked) {
e.preventDefault();
e.stopPropagation();
me.isDrawing = true;
me.context.beginPath();
me.context.moveTo(e.offsetX || e.layerX, e.offsetY || e.layerY);
}
},
draw: function(e) {
var me = this;
if (me.isDrawing) {
e.preventDefault();
e.stopPropagation();
me.context.lineTo(e.offsetX || e.layerX, e.offsetY || e.layerY);
me.context.stroke();
}
},
最佳答案
CSS 对 IE 11 有效(IE 10 的前缀)
touch-action: none
触摸事件是 IE11(IE 10 的前缀)中的指针事件。
关于javascript - 取消移动 IE 11 上事件的滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24227919/