jquery slider start at top?
I know you can make the slider go vertical, but is there a way to start it at the top and make it go to the bottom rather then the bottom and go开发者_运维问答ing to the top?
Regards,
$( ".selector" ).slider({ value: 100 });
That will start the slider at the top of a default max and min slider. If you changed the max value just change were it says 100 up there to be your new max value. Few style changes and you could make it appear as your max is actually your min. Good luck.
Also quick note, then when you want to get your value since its upside down if its 100 you actually want the value to be 0 while 90 should be 10. You can get that by taking:
|(Actual Value) - 100|
in your code. There is no way to actually non ghetto rigging achieve what your goal is.
If you look at the documentation and then the source of the example it should be what you need. Just set the value accordingly.
http://jqueryui.com/demos/slider/#slider-vertical
$(function() {
$("#slider-vertical").slider({
orientation: "vertical",
range: "min",
min: 0,
max: 100,
value: 60,
slide: function(event, ui) {
$("#amount").val(ui.value);
}
});
$("#amount").val( $("#slider-vertical").slider("value") );
});
You see they have the range of the slider of 0 to 100. 0 is the bottom and 100 the top. That should be all you need.
精彩评论