From 979d457b7b27473fcd86273746b4599c54ec371e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 1 Oct 2017 01:16:16 +0200 Subject: [PATCH] fixed broken wheel number box flipping caused by some dubious optimization --- js/appcommon.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/appcommon.js b/js/appcommon.js index 0f103df..963bc5a 100644 --- a/js/appcommon.js +++ b/js/appcommon.js @@ -61,7 +61,7 @@ $.ready(function () { }, 1000) // flipping number boxes with the mouse wheel - $('input[type=number]').on('mousewheel', function (e) { + $('input[type=number]').on('wheel', function (e) { let $this = $(this) let val = +$this.val() if (isNaN(val)) val = 1 @@ -69,14 +69,14 @@ $.ready(function () { const step = +($this.attr('step') || 1) const min = +$this.attr('min') const max = +$this.attr('max') - if (e.wheelDelta > 0) { + if (e.deltaY > 0) { val += step } else { val -= step } - if (!Number.isFinite(min)) val = Math.max(val, +min) - if (!Number.isFinite(max)) val = Math.min(val, +max) + if (Number.isFinite(min)) val = Math.max(val, +min) + if (Number.isFinite(max)) val = Math.min(val, +max) $this.val(val) if ('createEvent' in document) {