admin管理员组文章数量:1401665
I'd want to achieve something like this:
From X elements, I'd like to choose the number of 'OK', the number or 'partially OK' and the number of 'not OK'. The three range are not superposable, obviously, and the sum is always X.
I tried to start from the standard jQuery UI slider, but the main background is unique, hence I cannot have the green and the red color together.
Is there any plugin that already do this? Or any idea on which is the easiest way to do with the standard jQuery plugin?
I'd want to achieve something like this:
From X elements, I'd like to choose the number of 'OK', the number or 'partially OK' and the number of 'not OK'. The three range are not superposable, obviously, and the sum is always X.
I tried to start from the standard jQuery UI slider, but the main background is unique, hence I cannot have the green and the red color together.
Is there any plugin that already do this? Or any idea on which is the easiest way to do with the standard jQuery plugin?
Share Improve this question asked Oct 2, 2013 at 16:43 user1679640user16796401 Answer
Reset to default 7jQuery UI slider gives you it's values, as you can see in the demo:
$( "#slider-range" ).slider({
slide: function( event, ui ) {
/* here, you can play with it */
}
});
I'd set background color of the slider to green, background color of the middle part to yellow and add a div
positioned to the right of the slider with dynamically adjusted width, so that it stratches from right to left
$( "#slider-range" ).slider({
slide: function( event, ui ) {
$('#YourDiv').css('width', ui.values[1]); /* obviously, you have to multiply the value of the slider by something to fit your design */
}
});
In the jQuery UI demo, the div would have styles like this:
#YourDiv {
float: right;
height: 100%;
background: red;
width: 50px; /* this would be dynamic */
border-radius: 0 4px 4px 0;
}
I made a little Fiddle DEMO
本文标签: javascriptjQuery slider with range and three different backgroundcolorStack Overflow
版权声明:本文标题:javascript - jQuery slider with range and three different background-color - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744307664a2599876.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论