- var firefox = navigator.userAgent.indexOf('Firefox') != -1;
- firefox ? img.addEventListener('DOMMouseScroll', MouseWheel, false) :
- (img.onmousewheel = MouseWheel);
- function MouseWheel(e) {
- e = e || window.event;
- if (e.stopPropagation) e.stopPropagation();
- else e.cancelBubble = true;
- if (e.preventDefault) e.preventDefault();
- else e.returnValue = false;
- }
- //该片段来自于http://www.codesnippet.cn/detail/2807201513233.html
来源: http://www.codesnippet.cn/detail/2807201513233.html