Created
June 30, 2014 12:58
-
-
Save pererinha/aaef044b021bbf7372e5 to your computer and use it in GitHub Desktop.
Angular JS Directive - to disable mouse wheel on input type number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| directive( 'ignoreMouseWheel', function( $rootScope ) { | |
| return { | |
| restrict: 'A', | |
| link: function( scope, element, attrs ){ | |
| element.bind('mousewheel', function ( event ) { | |
| element.blur(); | |
| } ); | |
| } | |
| } | |
| } ); | |
| // <input type="number" ignore-mouse-wheel ... > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
wheelevent is compatible with both Chrome and Firefox. In Firefox,mousewheeldoes not work. See also here.