]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Add possibility to disable slider after initialization.
authorMarius Olbertz <marius.olbertz@gmail.com>
Fri, 1 Apr 2016 14:55:26 +0000 (16:55 +0200)
committerMarius Olbertz <marius.olbertz@gmail.com>
Fri, 1 Apr 2016 14:55:26 +0000 (16:55 +0200)
Slider will check for disabled state on every event now rather than only at its initialization.

js/foundation.slider.js

index 71c7a91b9caeb20bbcf5f6c8d0f1c4a694415e24..ec93ac4b35c440c7207b0480179d96679b5d0176 100644 (file)
@@ -106,7 +106,11 @@ class Slider {
    * @fires Slider#changed
    */
   _setHandlePos($hndl, location, noInvert, cb) {
-  //might need to alter that slightly for bars that will have odd number selections.
+    // don't move if the slider has been disabled since its initialization
+    if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) {
+      return;
+    }
+    //might need to alter that slightly for bars that will have odd number selections.
     location = parseFloat(location);//on input change events, convert string to number...grumble.
 
     // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max