Here's an example of what you can do:

HTML:

<div id="slider"></div>
<div id="slider-value"></div>

JavaScript:

$(function() {
  $("#slider").slider({
    range: "min",
    min: 0,
    max: 5,
    value: 0,
    slide: function(event, ui) {
      $("#slider-value").html(ui.value);
    }
  });
  
  $("#slider-value").html($("#slider").slider("value"));
});

CSS:

#slider {
  width: 200px;
  margin: 20px;
}

#slider-value {
  text-align: center;
  font-size: 24px;
  margin-top: 20px;
}

This code creates a slider with a range from 0 to 5, and a single selector that starts from 0. The value of the slider is displayed in a separate div. The slider is also set to be right-to-left by default.


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

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