Answer the question
In order to leave comments, you need to log in
How to disable scroll wheel on google map without using API?
I would like to just take an iframe map and turn off the zoom with the scroll wheel. How to do it painlessly? I don’t want to contact the API there is a quiet horror in the code
Answer the question
In order to leave comments, you need to log in
Everything is simple if you know about the 3 phases of events.
By using Capture Phase and stopPropagation , we simply prevent the event from descending from window to the target node.
document.addEventListener('mousewheel', cancel, true); // webkit + IE
document.addEventListener('DOMMouseScroll', cancel, true); // Самые древние FF
document.addEventListener('MozMousePixelScroll', cancel, true); // FF с версии 3.5
document.addEventListener('wheel', cancel, true); // FF с версии 31
function cancel (e) {
e.stopPropagation();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question