So I’m trying to disable scrolling on my page when my lightbox opens, and I found this really usefull script that does exactly that. (http://jsfiddle.net/mrtsherman/eXQf3/3/), unfortunately, when I use it on my own page, it disabled scrolling in my lightbox as well. I started to debug the code with alerts only to find out that event.wheelDelta returns “undefined” on my page, while in the JSFiddle, it returns -120.
Share
The
eventobject in a jQuery event handler does not reflect the real event.wheelDeltais a non-standard event propertyIE and Opera, available through theoriginalEventproperty of the jQuery event.In jQuery 1.7+, the
detailproperty is not available at the jQuery Event object. So, you should also useevent.originalEvent.detailto for this property at theDOMMouseScrollevent. This method is backwards-compatible with older jQuery versions.Demo: http://jsfiddle.net/eXQf3/22/
See also: http://api.jquery.com/category/events/event-object/