admin管理员组文章数量:1415460
I wish to have a slider that is from 0-100 but that is only selectable from 0-75 (for example)
An example look would be something like this, with the slider restricted from entering the coloured region
Clearly I would like to be able to set the max, min, limit and value of the slider...
As far as I can see the jquery UI Slider does not allow this out of the box. I expect it is possible to extend the basic behaviour but I would need a very clear hand holding to make that work!
I wish to have a slider that is from 0-100 but that is only selectable from 0-75 (for example)
An example look would be something like this, with the slider restricted from entering the coloured region
Clearly I would like to be able to set the max, min, limit and value of the slider...
As far as I can see the jquery UI Slider does not allow this out of the box. I expect it is possible to extend the basic behaviour but I would need a very clear hand holding to make that work!
Share Improve this question asked Aug 22, 2011 at 14:43 LooferLoofer 6,9939 gold badges65 silver badges106 bronze badges1 Answer
Reset to default 9You can use the slide
event of slider plugin which is triggered on every mouse move during slide. Use ui.value
to obtain the value of the current handle and check for the max limit and return false. Returning false
from this callback prevents the slide.
$(".selector").slider({
slide: function(event, ui) {
if(ui.value > 75){//Note the value of ui.value is between 0 to 99
return false;
}
}
});
For the background color of the slider you can easily achieve it through css.
本文标签:
版权声明:本文标题:Is there a javascript (jquery) slider that limits the values independently of the display values? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745182492a2646530.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论