How would I stop the propagation of clicking and scrolling on a div, overlaying a leaflet map? That seems to be very tricky... Something like
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);
}
}
doesn't do anyhting. It needs to work in IE as well...
http://jsfiddle.net/LnzN2/4888/
Move your parent-div
outside of the map
div.
Change your HTML to:
<div
id="map">
</div>
<div
id='parent-div'
class='some-div'>
I am the parent! Like the leaflet map, I don't want the mouse events clicking/scrolling bubbling onto me neither.
<div
class='some-div'
id='no-scrolling-clicking'>
Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me! Stop Scrolling and clicking Event in me!
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With