When you use the scroll wheel to interact with the page and scroll the page vertically (both downward and upward), The mousewheel event is triggered. This event can be triggered on any element and will eventually bubble to the document (IE) or window (opera, chrome, and Safari) object. The mousewheel event is triggered in IE. Dommousescroll event triggered in Firefox. You can bind two events to the element in use. Use E. preventdefault () in the standard browser; then cancel the bubble E. stoppropagation. If E. preventdefault () is used directly, an error is reported in IE. This method is not supported. Therefore, a judgment is required. If (E. preventdefault) {e. preventdefault ()} ie earlier versions do not support this method. Use returnvalue = flase to prevent default events. Use return false with caution;
Getwheeldelta:Function(Event ){If(Event. wheeldelta) {// The IE browser returns the plus or minus 120ReturnEvent. wheeldelta ;}Else{// The standard browser returns Positive and Negative 3Return-Event. Detail * 4;}}
Demo: