From 4a9d60e60ac8fb87044c3a6633a0a9e0e0cd9615 Mon Sep 17 00:00:00 2001 From: Roger Lamb Date: Fri, 1 Nov 2013 11:06:29 -0400 Subject: [PATCH 1/2] Add option 'scroll' to disable scrolling --- README.md | 1 + js/jquery.knob.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c6dd33..f4d3f6b 100755 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Behaviors : * angleArc : arc size in degrees | default=360. * stopper : stop at min & max on keydown/mousewheel | default=true. * readOnly : disable input and events | default=false. +* scroll : disable reaction to mouse scrollwheel | default=true. UI : * cursor : display mode "cursor", cursor size could be changed passing a numeric value to the option, default width is used when passing boolean value "true" | default=gauge. diff --git a/js/jquery.knob.js b/js/jquery.knob.js index d6fa7b7..7701fc4 100755 --- a/js/jquery.knob.js +++ b/js/jquery.knob.js @@ -93,6 +93,7 @@ max : this.$.data('max') || 100, stopper : true, readOnly : this.$.data('readonly') || (this.$.attr('readonly') == 'readonly'), + scroll : this.$.data('scroll') || true, // UI cursor : (this.$.data('cursor') === true && 30) @@ -629,8 +630,10 @@ } ); - this.$c.bind("mousewheel DOMMouseScroll", mw); - this.$.bind("mousewheel DOMMouseScroll", mw) + if (s.o.scroll) { + this.$c.bind("mousewheel DOMMouseScroll", mw); + this.$.bind("mousewheel DOMMouseScroll", mw) + } }; this.init = function () { From be1084dbdd727875f695a89aebbee5fb76f75b33 Mon Sep 17 00:00:00 2001 From: Roger Lamb Date: Fri, 1 Nov 2013 11:23:40 -0400 Subject: [PATCH 2/2] Add omitted semicolon --- js/jquery.knob.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.knob.js b/js/jquery.knob.js index 7701fc4..5d0f50b 100755 --- a/js/jquery.knob.js +++ b/js/jquery.knob.js @@ -632,7 +632,7 @@ if (s.o.scroll) { this.$c.bind("mousewheel DOMMouseScroll", mw); - this.$.bind("mousewheel DOMMouseScroll", mw) + this.$.bind("mousewheel DOMMouseScroll", mw); } };