function crossUpdate ( value, slider ) { // If the sliders aren't interlocked, don't // cross-update. if ( !lockedState ) return; // Select whether to increase or decrease // the other slider value. var a = slider1 === slider ? 0 : 1; // Invert a var b = a ? 0 : 1; // Offset the slider value. value -= lockedValues[b] - lockedValues[a]; // Set the value slider.noUiSlider.set(value); }