circular-slider

Circular Slider - A JQuery plugin

Subscribe to updates I use circular-slider


Statistics on circular-slider

Number of watchers on Github 68
Number of open issues 3
Average time to close an issue 7 days
Main language JavaScript
Average time to merge a PR 7 days
Open pull requests 0+
Closed pull requests 0+
Last commit over 3 years ago
Repo Created over 4 years ago
Repo Last Updated 10 months ago
Size 428 KB
Homepage http://www.toolit...
Organization / Authorprincejwesley
Latest Release1.0.8
Contributors3
Page Updated
Do you use circular-slider? Leave a review!
View open issues (3)
View circular-slider activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating circular-slider for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

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

Gitter

circular slider

For angular version(without JQuery dependency), Try Angular Circular Slider

Getting Started

Download the latest code

Fork this repository or download js/css files from dist directory.

Including it on your page

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>

Basic Usage

<div id="slider"></div>
var slider = $('#slider').CircularSlider();

Properties

radius

radius of the circle in px.

innerCircleRatio

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).

min

min value of the slider.

max

max value of the slider.

value

Initial value of the slider.

clockwise

direction of the sliding value.

labelSuffix

label to be used as suffix along with current sliding value.

labelPrefix

label to be used as prefix along with current sliding value.

shape

shape of the slider. Supported shapes are:

  1. 'Circle' (default)
  2. 'Half Circle'
  3. 'Half Circle Left'
  4. 'Half Circle Right'
  5. 'Half Circle Bottom'

touch

touch support. (default: true)

animate

linear animation support. (dafault: true)

animateDuration

Animation duration in milliseconds. (default: 360ms)

selectable

text selection enabled or not. (default: false)

handleDist

Distance between handle and shape center in percentage(default: 100)

Functions

function setValue(value)

Set current value of the slider.

function getValue()

Get current value of the slider.

function setRange(min, max)

Set sliding range of the slider. min is a minimum value and max is a maximum sliding value. If the current value is not in range, min will be set as current value

function getRadius()

Get current radius of the slider.

function setRadius(radius)

Set current radius of the slider.

function getAnimate()

Get current animate property of the slider.

function setAnimate(animate)

Set current animate property of the slider.

function getAnimateDuration()

Get current animateDuration value of the slider.

function setAnimateDuration(duration)

Set current animateDuration value of the slider.

Callback

function slide(ui, value)

slide callback is triggered whenever there is a change in sliding value.

Parameters:

ui -  dom element
value - Current sliding value

function onSlideEnd(ui, value)

onSlideEnd callback is triggered when the user action is done (on mouse up/touch end or click).

Parameters:

ui -  dom element
value - Current sliding value

function formLabel(value, prefix, suffix)

formLabel callback 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

Default Settings

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
});

CSS classes

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 });
    }
});

License

This plugin is licensed under the MIT license.

Copyright (c) 2014 Prince John Wesley

circular-slider open issues Ask a question     (View All Issues)
  • over 2 years Not working correctly
  • almost 3 years Slider indicator position issue
  • over 3 years Mobile support?
circular-slider questions on Stackoverflow (View All Questions)
  • How to Clone Existing Items Into Circular Slider On Beginning and End
  • how to do dual circular slider (clock like function)
  • jQuery circular slider?
  • how to make carousel circular slider with rotation?
  • Making circular slider in wp8
  • How to insert touch events into html5 circular slider?
  • Steps feature in circular slider
  • How to set value of circular slider in jquery?
  • Circular Slider using Jquery
  • jQuery: Creating a circular slider
  • Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element' - Angular Circular Slider
  • Add value ticks into my Circular Slider
  • Circular slider for Apple Watch?
  • custom circular slider control in iPhone with images
  • iOS Circular Slider
  • jQuery Infinite Knob/circular slider/dial input
  • Change value of clock with circular slider in iOS
  • Not allow slide from 1% to 100% and vice versa in Circular Slider iOS
  • how to set image on circular slider IOS
  • Fill in the translucent color insider the circular slider
  • RealBasic Circular Slider
  • Circular Slider in ActionScript 3
  • How to avoid circular slider?
  • In this Circular Slider code prev and Next function is not working properly
  • Circular-slider weird behaviour while animating with CA
  • Get previous elements in circular slider
  • Give angles to images in circular slider
  • How to create circular Slider WPF
  • Semi Circular Slider
  • jQuery edge to edge circular slider/carousel
circular-slider list of languages used
More projects by princejwesley View all
Other projects in JavaScript