Disabling scroll increment/decrement on Number inputs

This commit is contained in:
Will Marshall
2014-04-30 10:57:30 +10:00
parent e08f0a5feb
commit 22aaa24962
3 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
Darkswarm.directive "ofnDisableScroll", ()->
restrict: 'A'
link: (scope, element, attrs)->
element.bind 'focus', ->
element.bind 'mousewheel', (e)->
e.preventDefault()
element.bind 'blur', ->
element.unbind 'mousewheel'

View File

@@ -49,6 +49,7 @@
%input{type: :number,
value: nil,
min: 0,
"ofn-disable-scroll" => true,
max: "{{product.on_demand && 9999 || product.count_on_hand }}",
name: "variants[{{product.master.id}}]",
id: "variants_{{product.master.id}}",
@@ -58,6 +59,7 @@
%span{"ng-show" => "product.group_buy && (product.variants.length == 0)"}
%input{type: :number,
min: 0,
"ofn-disable-scroll" => true,
max: "{{product.on_demand && 9999 || product.count_on_hand }}",
name: "variant_attributes[{{product.master.id}}][max_quantity]",
"ng-model" => "product.max_quantity"}

View File

@@ -6,6 +6,7 @@
%input{type: :number,
value: nil,
min: 0,
"ofn-disable-scroll" => true,
max: "{{variant.on_demand && 9999 || variant.count_on_hand }}",
name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}",
"ng-model" => "variant.quantity"}
@@ -13,6 +14,7 @@
%span{"ng-show" => "product.group_buy"}
%input{type: :number,
min: 0,
"ofn-disable-scroll" => true,
max: "{{variant.on_demand && 9999 || variant.count_on_hand }}",
name: "variant_attributes[{{variant.id}}][max_quantity]",
"ng-model" => "variant.max_quantity"}