To set the default starting and ending values of the price slider to 0 and 2000 respectively, you need to modify the code as follows:
\

$(function() {\
  $( "#slider-range" ).slider({\
    range: true,\
    min: 0,\
    max: 2000, // Updated maximum value\
    values: [ 0, 2000 ], // Updated default values\
    slide: function( event, ui ) {\
      $( "#amount" ).html( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );\
      $( "#min" ).val(ui.values[ 0 ]);\
      $( "#max" ).val(ui.values[ 1 ]);\
    }\
  });\
  $( "#amount" ).html( "$" + $( "#slider-range" ).slider( "values", 0 ) +\
   " - $" + $( "#slider-range" ).slider( "values", 1 ) );\
});\
```\
\
By setting the `min` value to 0 and the `max` value to 2000, and updating the `values` array to [0, 2000], the price slider will start at 0 and end at 2000 by default.
jQuery Price Slider: Set Default Range to 0-2000

原文地址: https://www.cveoy.top/t/topic/qfgW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录