我正在一个项目中,我有几个jq UI滑块。我有一个特殊的只有5个步骤。这里是fiddle,这里是代码段(第一小提琴和摘要):5个步骤顺利jquery Ui滑块
$(function() {
$("#slider").slider({
min: 1,
range: false,
max: 5,
value: 1,
animate:"slow",
orientation: "horizontal",
slide: function(event, ui) {
$(".value").text("slider value: " + ui.value);
}
});
});
body {
padding: 0px;
margin: 0px;
background-color: #333;
color: #FFF;
font-family: arial;
font-size: 20px;
}
.slider-holder {
padding: 15px;
margin: 0px;
}
.value {
margin: 15px 0px 0px 0px;
display: inline-block;
}
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
</head>
<body>
<div class="slider-holder">
<div id="slider"></div>
<a class="value">slider value: 1</a>
</div>
</body>
</html>
我想滑动顺畅这样jsfiddle和这个片段(第一小提琴和摘要):
$(function() {
$("#slider").slider({
min: 1,
range: false,
max: 1000,
value: 1,
animate:"slow",
orientation: "horizontal",
slide: function(event, ui) {
$(".value").text("slider value: " + ui.value);
}
});
});
body {
padding: 0px;
margin: 0px;
background-color: #333;
color: #FFF;
font-family: arial;
font-size: 20px;
}
.slider-holder {
padding: 15px;
margin: 0px;
}
.value {
margin: 15px 0px 0px 0px;
display: inline-block;
}
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
</head>
<body>
<div class="slider-holder">
<div id="slider"></div>
<a class="value">slider value: 1</a>
</div>
</body>
</html>
我想WH用户单击并按住滑块手柄并移动手柄,它应该像小提琴和片段2一样清晰移动。但它只有5个值。
我该怎么办?
感谢@PVL。有效!但你能提供更平滑吗? –
@Shohidul Alam是的,只需添加步骤:.00001例如。我有更新的代码。 – PVL
非常感谢@PVL。我其实是新的jQuery UI滑块。所以我不知道stape。你向我展示了它是什么。再次非常感谢你。 :) –