admin管理员组文章数量:1279212
You may have seen JavaScript sliders before:
.5b2/demos/ui.slider.html
What I'm envisioning is a circular slider. It would consist of a draggable button at one point on the circle -- and that button can be dragged anywhere along the ring. The value depends on what position the button is at (think of a clock).
You may have seen JavaScript sliders before:
http://dev.jquery./view/tags/ui/1.5b2/demos/ui.slider.html
What I'm envisioning is a circular slider. It would consist of a draggable button at one point on the circle -- and that button can be dragged anywhere along the ring. The value depends on what position the button is at (think of a clock).
Share Improve this question edited Dec 28, 2017 at 7:03 Rahul Gupta 10.2k7 gold badges64 silver badges69 bronze badges asked Dec 8, 2008 at 23:55 MattMatt 3,8969 gold badges37 silver badges37 bronze badges4 Answers
Reset to default 4define a center point c current mouse point at m
in your mouse drag event handler, you'd have
var dx = m.x-c.x;
var dy = m.y-c.y;
var scale = radius/Math.sqrt(dx*dx+dy*dy);
slider.x = dx*scale + c.x;
slider.y = dy*scale + c.y;
radius would be some preset value of the slider,
How about this: http://www.thewebmasterservice./dev-blog/curved-rounded-or-circular-sliders-javascript-jquery-ui
Some explanations and a demo.
I have written a jQuery plugin which supports full/half circle sliders.
Demo Page & Documentation
Check the jQuery roundSlider plugin from here http://roundsliderui./. This is what you want exactly.
This roundslider having the similar options like the jQuery ui slider. It support default, min-range and range slider type. Not only the round slider it also supports various circle shapes such as quarter, half and pie circle shapes.
For more details check the demos and documentation page.
Please check the demo from jsFiddle
.
Related answers: https://stackoverflow./a/31367164/1845801 and https://stackoverflow./a/31369265/1845801
Screenshots:
本文标签: javascriptjQuery Creating a circular sliderStack Overflow
版权声明:本文标题:javascript - jQuery: Creating a circular slider - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741262303a2367853.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论