My colleague who is responsible for Flash asks me help him block document scroll default action.
And I add the following code to help him.
<script type="text/javascript">
(function (document) {
var cancelscroll = function (e){
e.preventDefault();
};
if ('onmousewheel' in document) {
document.getElementById('container').onmousewheel = cancelscroll;
} else {
document.getElementById('container').addEventListener('DOMMouseScroll', cancelscroll, false);
}
})(document);
</script>
It works well in IE9 and Firefox, but it also blocks Flash scroll event in Chrome.
I think it is weird, the snippet should only block JavaScript event, why it also blocks Flash event.
My colleague said he registers scroll event by this snippet:
stage.addEventListener(MouseEvent.MOUSE_WHEEL, mask_wheel);
He only get the delta value in the callback, without doing other task.
I'm not familiar with Flash, and my colleague isn't familiar with JavaScript...
Anyone has this problem, too? How to fix it? Thanks.