Skip to content

@holysugar /prevent-wheel.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
prevent wheel events
// require jquery
jQuery(function(){
var WheelControl = {
_enabled: true,
enable: function(enabled) {
Aiming.WheelControl._enabled = enabled;
},
onMouseWheel: function(event) {
if (!Aiming.WheelControl._enabled) {
if (!event) {
event = window.event;
}
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
}
}
}
if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', WheelControl.onMouseWheel, false);
}
window.onmousewheel = document.onmousewheel = WheelControl.onMouseWheel;
$('.prevent-wheel').hover(
function() { WheelControl.enable(false) },
function() { WheelControl.enable(true) }
)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.