Home

Awesome

radios-to-slider

If you are using angular, check out this awesome AngularJS Module by wodka

Bower version

jQuery plugin to create a slider using a list of radio buttons

Usage

<div id="radios">
    <input id="option1" name="options" type="radio" value="1">
    <label for="option1">1 <br>year</label>

    <input id="option2" name="options" type="radio" value="2">
    <label for="option2">2 years</label>

    <input id="option3" name="options" type="radio" value="3" checked>
    <label for="option3">3 years</label>

    <input id="option4" name="options" type="radio" value="4">
    <label for="option4">4 years</label>

    <input id="option5" name="options" type="radio" value="5">
    <label for="option5">5+ years</label>
</div>

<script>
    $(document).ready(function(){
        var radios = $("#radios").radiosToSlider();

        // Disable input
        radios.setDisable();

        // Enable input
        radios.setEnable();

        // Retrieve value
        radios.getValue();
    });
</script>

Options

OptionValuesDefault
animationtrue, falsetrue
onSelectcallbacknull
sizestring"medium"
fitContainertrue, falsetrue
isDisabletrue, falsefalse

API

FunctionCallbackArgs
setDisabletrue$levels, $inputs
setEnabletrue$levels, $inputs
getValuefalse-
EventsTriggered
radiochangeIf triggered [click, change] events
radiodisabledWhen disabled radio
radiodenabledWhen enabled radio

Demo and examples