我已经为下面提到的圆形滑块编写了代码。我无法弄清楚如何将滑块的值存储在变量中并使用 javascript 在控制台中显示它。我想将工具提示的值存储在一个变量中并将其显示在控制台中,以便它可以用于其他功能。
$("#slider").roundSlider({
radius: 180,
min: 10,
max: 30,
startValue: 24,
circleShape: "pie",
sliderType: "min-range",
value: 50,
editableTooltip: false,
startAngle: 315,
tooltipFormat: "changeTooltip",
});
window.updateBox = function(e) {
var profit = Math.round(this.options.value * 0.005);
}
window.changeTooltip = function(e) {
updateBox.call(this);
return e.value + "°C";
}
body {
background-color: black;
}
#slider {
position: absolute;
top: 20%;
left: 40%;
z-index: 1000;
}
.rs-control .rs-range-color {
background-color: #45a8f8;
}
.rs-control .rs-path-color {
background-color: #191917;
}
.rs-control .rs-handle {
background-color: #4b8aff;
}
.rs-control .rs-bg-color {
background-color: #000000;
}
#slider .rs-border {
border-color: transparent;
}
#slider .rs-tooltip-text {
font-size: 50px;
font-weight: bold;
font-color: white
}
.rs-tooltip.rs-tooltip-text {
font-size: 19px;
font-weight: 500;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-color: White;
background-color: White;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.3.2/roundslider.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.3.2/roundslider.min.js">
.
</script>
<div id="slider"></div>