如何停止在div上单击并滚动并覆盖传单地图的行为?这似乎很棘手... 像
customPreventDefault(e) {
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
}
document.getElementById('no-scrolling-clicking').onmousewheel =
function (e) {
document.getElementById('prevent-scrolling').scrollTop -= e.wheelDeltaY;
customPreventDefault(e);
}
}
不做任何事情。它也需要在IE中工作...
答案 0 :(得分:0)
leaflet
为此提供了功能。
var div = L.DomUtil.get('no-scrolling-clicking');
L.DomEvent.on(div, 'mousewheel', L.DomEvent.stopPropagation);
L.DomEvent.on(div, 'click', L.DomEvent.stopPropagation);