javascript - Foundation Range Slider Cannot Impose Limits -
i have screen can have multiple range sliders on it. each slider has total range of 0 maximum combination of sliders can have. example start: 0; end: 20;
within application set limits values user can select via sliders. while slider visual range gives full appearance of 0 - 20 each individual slider user can select 2 - 10 , later validate total sum of sliders within acceptable range 20.
currently have code seems nothing
self.$qtyform.on('change.fndtn.slider', '.range-slider', function (e) { var $rng = $(this), qty = parseint($rng.data('slider'), 10); if (qty > maxchoiceqty) { $rng.foundation('slider', 'set_value', maxchoiceqty); } if (qty < minchoiceqty) { $rng.foundation('slider', 'set_value', minchoiceqty); } }); i noticed touch slider knob change event fires. firing 50 times while user changing range doesn't seem right. way limit or use event
jquery stores data- attributes internally once loaded. replace line:
qty = parseint($rng.data('slider'), 10)
with this:
qty = $($rng).attr('data-slider')
and should current slider value.
Comments
Post a Comment