disable mousewheel on numeric input fields

This commit is contained in:
Javier 2016-07-12 11:13:15 -03:00
commit 93b543e878
2 changed files with 17 additions and 4 deletions

View file

@ -427,8 +427,8 @@
<span translate>Amount</span>
</label>
<div class="input">
<input type="number" id="amount" ng-disabled=" home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)">
<input type="number" id="alternative" name="alternative" ng-model="_alternative" style="display:none">
<input type="number" id="amount" ng-disabled=" home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)" ignore-mouse-wheel>
<input type="number" id="alternative" name="alternative" ng-model="_alternative" style="display:none" ignore-mouse-wheel>
<a class="postfix button" ng-style="{'background-color':index.backgroundColor}" ng-click="home.showAlternative()">{{home.unitName}}</a>
</div>
</div>
@ -436,8 +436,8 @@
<label for="alternative"><span translate>Amount</span> [{{ home.alternativeIsoCode }}]
</label>
<div class="input">
<input type="number" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)">
<input type="number" id="amount" name="amount" ng-model="_amount" style="display:none">
<input type="number" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)" ignore-mouse-wheel>
<input type="number" id="amount" name="amount" ng-model="_amount" style="display:none" ignore-mouse-wheel>
<a class="postfix button black" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a>
</div>
</div>

View file

@ -325,4 +325,17 @@ angular.module('copayApp.directives')
replace: true,
templateUrl: 'views/includes/available-balance.html'
}
})
.directive('ignoreMouseWheel', function($rootScope, $timeout) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('mousewheel', function(event) {
element[0].blur();
$timeout(function() {
element[0].focus();
}, 1);
});
}
}
});