有没有一种方法可以使jQuery UI滑块的顶部从0开始而不是从底部开始? [英] Is there a way to make the jQuery UI slider start with 0 on top instead of on bottom?
本文介绍了有没有一种方法可以使jQuery UI滑块的顶部从0开始而不是从底部开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请查看jQuery UI Slider的演示.
Look at this demo of the jQuery UI Slider.
请注意,当手柄向下按到底时,值是0?
Notice how when the handle is down the bottom, the value is 0?
是否有办法将其反转,所以最上方的手柄为0,最下方的手柄为最大范围?
Is there a way to reverse this, so the handle up the very top is 0, and the handle down the bottom is the max range?
我已经对这些选项进行了一些尝试,但是到目前为止,仍然无法使其正常工作.
I've played a bit with the options, but so far have been unable to get it to work.
推荐答案
不要反转它,采取简单的方法:)只需从最大值中减去该值即可,例如:
Don't reverse it, take the easy way out :) Just subtract the value from your max, for example:
$("#slider-vertical").slider({
orientation: "vertical",
range: "min",
min: 0,
max: 100,
slide: function(event, ui) {
$("#amount").val(100 - ui.value);
}
});
这只是max-value
,有效地将其反转,您可以在此处看到一个快速演示.
This just goes max-value
, effectively reversing it, you can see a quick demo here.
这篇关于有没有一种方法可以使jQuery UI滑块的顶部从0开始而不是从底部开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文