File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,15 @@ <h2 class="mb-6 text-2xl font-semibold text-gray-800">
103103 < input type ="text " data-range-slider-target ="inputMin " value ="5 ">
104104 </ div >
105105
106+ <!-- Single Range Slider with Labels, negavtive numbers and markers -->
107+ < div data-controller ="range-slider " data-range-slider-values-value ="-5..5 " data-range-slider-labels-value ="true "
108+ data-range-slider-markers-value ="true ">
109+ < label class ="block mb-2 text-sm font-medium text-gray-700 "> Example of single range slider with
110+ labels and markers</ label >
111+
112+ < input type ="text " data-range-slider-target ="inputMin " value ="0 ">
113+ </ div >
114+
106115 <!-- Single Range Slider with Labels and Step -->
107116 < div data-controller ="range-slider " data-range-slider-values-value ="0..150 " data-range-slider-labels-value ="true "
108117 data-range-slider-step-value ="10 ">
Original file line number Diff line number Diff line change @@ -452,10 +452,8 @@ export default class extends Controller {
452452 parseRange ( min , max , step ) {
453453 if ( ! max || ! step ) return null ;
454454
455- return Array . from (
456- { length : Math . ceil ( ( max - min + 1 ) / step ) } ,
457- ( _ , i ) => min + i * step
458- ) ;
455+ const count = Math . floor ( ( max - min ) / step ) + 1 ;
456+ return Array . from ( { length : count } , ( _ , i ) => min + i * step ) ;
459457 }
460458
461459 createElement ( el , klass , dataAttr ) {
You can’t perform that action at this time.
0 commit comments