javascript - I want to implement increment slider with multiple steps in jQuery ui slider -
basically i'm trying implement jquery step slider given in link link.
slider should $0 $100,000 should increase in increments of $100 till $10,000 $1000 increments $10,000 $20,000 $10,000 increments $20,000 $100,000
i have tried implement code 0-1000 not working after working fine. below code have used:-
html:
<div class="range-slider-div-outer"> <div class="range-slider-div"> <div id="slider-range"></div> <div class="slider-input"> <input type="text" id="amount1" class="form-control pull-left" readonly> <span class="to-span"> </span> <input type="text" id="amount2" class="form-control pull-right" readonly> </div> </div> </div>
jquery:
$( function() { $( "#slider-range" ).slider({ range: true, min: 0, max:100000, // step: 100, values: [1000, 20000 ], slide: function( event, ui ) { $( "#amount1" ).val( "$" + ui.values[ 0 ]); $( "#amount2" ).val( "$" + ui.values[ 1 ]); var amt = $( "#amount2" ).val(); amt = amt.slice(1); var step = $('#slider-range').slider('option', 'step'); if(amt>0) {$('#slider-range').slider('option', 'step', 100);} if(amt<10000) {$('#slider-range').slider('option', 'step', 100);} if(amt>10000) {$('#slider-range').slider('option', 'step', 1000);} if(amt<20000) {$('#slider-range').slider('option', 'step', 1000);} if(amt>20000) {$('#slider-range').slider('option', 'step', 10000);} } });
can me regarding this
Comments
Post a Comment