circular-slider - A jQuery Plugin
Circular slider is a jQuery plugin which helps to slide range of values and images. It supports half(top/bottom/up/down) and full circle shapes. #####Demo Page 
For angular version(without JQuery dependency), Try Angular Circular Slider
Fork this repository or download js/css files from dist directory.
Include jQuery and this plugin on a page.
<link rel="stylesheet" href="circular-slider.min.css" />
<script src="jquery.js"></script>
<script src="circular-slider.min.js"></script><div id="slider"></div>var slider = $('#slider').CircularSlider();
radiusof the circle in px.
ratio of inner circle area(used to display current sliding value). ratio can be in the range between 0.10 and 0.90 (open interval).
minvalue of the slider.
maxvalue of the slider.
Initial value of the slider.
direction of the sliding value.
label to be used as suffix along with current sliding
value.
label to be used as prefix along with current sliding
value.
shapeof the slider. Supported shapes are:
'Circle'(default)'Half Circle''Half Circle Left''Half Circle Right''Half Circle Bottom'
touchsupport. (default: true)
linear
animationsupport. (dafault: true)
Animation duration in milliseconds. (default: 360ms)
text selection enabled or not. (default: false)
Distance between handle and shape center in percentage(default: 100)
Set current
valueof the slider.
Get current
valueof the slider.
Set sliding range of the slider.
minis a minimum value andmaxis a maximum sliding value. If the currentvalueis not in range,minwill be set as currentvalue
Get current
radiusof the slider.
Set current
radiusof the slider.
Get current
animateproperty of the slider.
Set current
animateproperty of the slider.
Get current
animateDurationvalue of the slider.
Set current
animateDurationvalue of the slider.
slidecallback is triggered whenever there is a change in sliding value.
Parameters:
ui - dom element
value - Current sliding value
onSlideEndcallback is triggered when the user action is done (on mouse up/touch end or click).
Parameters:
ui - dom element
value - Current sliding value
formLabelcallback is triggered with current sliding value, prefix and suffix. If it is defined, it will be used as a source for inner circle area.
Parameters:
value - Current sliding value
prefix - prefix configured
suffix - suffix configured
Slider with default values
var slider = $('#slider').CircularSlider({
radius: 75,
innerCircleRatio: '0.5',
handleDist: 100,
min: 0,
max: 359,
value: 0,
clockwise: true,
labelSuffix: "",
labelPrefix: "",
shape: "Circle",
touch: true,
animate: true,
animateDuration : 360,
selectable: false,
slide: function(ui, value) {},
onSlideEnd: function(ui, value) {},
formLabel: undefined
});Use the below css classes for customization
.jcs-panel- circular slider panel
.jcs- Slider area
.jcs-value- Inner circle area
.jcs-indicator- Slide indicator ball
Advanced Usage (image carousel)
var imageSlider = $('#slider-customized').CircularSlider({
min : 0,
max: 359,
radius: 100,
innerCircleRatio : .7,
formLabel : function(value, prefix, suffix) {
return '<img src="assets/images/baby'+ parseInt(value / 26)+'.png"></img>';
},
slide : function(ui, value) {
var colors = ['deeppink', 'seagreen', 'deepskyblue', 'coral', 'cadetblue', 'olive', 'chocolate',
'yellowgreen', 'cornflowerblue', 'slategrey', 'salmon', 'brown', 'darkgoldenrod', 'dimgrey'];
var color = colors[parseInt(value / 26)];
ui.find('.jcs').css({'border-color' : color });
ui.find('.jcs-indicator').css({'background' : color });
}
});This plugin is licensed under the MIT license.
Copyright (c) 2014 Prince John Wesley
