From c71bdc8bebe69955c1884646b55e495a15f211da Mon Sep 17 00:00:00 2001 From: Gareth Daunton Date: Mon, 4 Jul 2016 12:38:58 -0400 Subject: [PATCH] Fixed events still firing while disabled --- src/definitions/modules/range.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/range.js b/src/definitions/modules/range.js index b3684660d..f7d094848 100644 --- a/src/definitions/modules/range.js +++ b/src/definitions/modules/range.js @@ -71,7 +71,8 @@ $.fn.range = function(parameters) { module.debug('Initializing range slider', settings); isTouch = module.get.isTouch(); module.setup.layout(); - module.bind.events(); + if(!module.is.disabled()) + module.bind.events(); module.read.metadata(); module.read.settings(); module.instantiate(); @@ -167,7 +168,8 @@ $.fn.range = function(parameters) { event: { down: function(event, originalEvent) { event.preventDefault(); - module.bind.documentEvents(); + if(!module.is.disabled()) + module.bind.documentEvents(); }, move: function(event, originalEvent) { event.preventDefault(); @@ -192,6 +194,12 @@ $.fn.range = function(parameters) { }, }, + is: { + disabled: function() { + return $module.hasClass(settings.className.disabled); + } + }, + get: { isTouch: function () { try { @@ -647,12 +655,13 @@ $.fn.range.settings = { step : 1, start : 0, input : false, - + //the decimal place to round to if step is undefined decimalPlaces : 2, className : { - reversed : 'reversed' + reversed : 'reversed', + disabled : 'disabled' }, onChange : function(value){},