Skip to content

Instantly share code, notes, and snippets.

@ryanhamley
Last active August 29, 2015 14:21
Show Gist options
  • Save ryanhamley/36e2d072d4be9cf191d1 to your computer and use it in GitHub Desktop.
Save ryanhamley/36e2d072d4be9cf191d1 to your computer and use it in GitHub Desktop.
An Angular directive for use with number inputs to prevent mousewheel events from changing the input.
angular.module('myApp')
.directive('ignoreMouseWheel', function () {
return {
restrict: 'A',
link: function (scope, element) {
element.bind('mousewheel', function() {
element[0].blur();
});
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment