动态获取slide的值
我有这个演示。
仅当刷新页面时该值才会更新,但我的想法是在移动指针时更新该值。
我使用 这个插件 但我认为这是基于jQuery UI 滑块。
在我的代码中,我有:
<script type="text/javascript">
$(function(){
$("#SliderSingle").slider({
from: 400,
to: 2000,
step: 2.5,
round: 1,
scale: ['400€', '600€', '800€', '1000€', '1200€', '1400€',
'1600€', '1800€', '2000€'],
dimension: ' €',
skin: "round",
slide: function(event, ui){
$("#amount").val('$' + ui.value);
}
});
$("#amount").val('$' + $("#SliderSingle").slider("value"));
});
</script>
唯一的问题是在移动指针时更新值。
I have this demo.
The value only updates if I refresh the page, but my idea is to update the value when the pointer is moved.
I use this plugin but I think that is based on the jQuery UI slider.
In my code I have:
<script type="text/javascript">
$(function(){
$("#SliderSingle").slider({
from: 400,
to: 2000,
step: 2.5,
round: 1,
scale: ['400€', '600€', '800€', '1000€', '1200€', '1400€',
'1600€', '1800€', '2000€'],
dimension: ' €',
skin: "round",
slide: function(event, ui){
$("#amount").val('
The only issue is just update the value when pointer is moved.
+ ui.value);
}
});
$("#amount").val('
The only issue is just update the value when pointer is moved.
+ $("#SliderSingle").slider("value"));
});
</script>
The only issue is just update the value when pointer is moved.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为这是建立在 jQueryUI 滑块上的。但是,您应该能够使用
callback
选项,该选项接受value
参数:工作示例:
I don't think this is built on the jQueryUI slider. However, you should be able to use the
callback
option, which accepts avalue
parameter:Working example: http://jsfiddle.net/HKhBH/