1

I have a slider with a range from 1007-13138 and a step of 75. But I need to add 2 custom steps that are outside the 75 range, ex. 2013 & 8759. These two values are what specify the start and end points of the slider so I want to be able to select them when sliding. Any suggestions or help would be appreciated - it's my first time using the slider and not quite sure of its capabilities, thanks.

HTML

<div id="slider" data-start="2013" data-end="8759"></div>
<div id="slider-result"></div>

jQuery

$('#slider').slider({
    value: $('#slider').data('end'),
    min: Math.round($('#slider').data('start') / 2),
    max: Math.round($('#slider').data('end') * 1.5),
    step: 75,
    slide: function (event, ui) {
        $('#slider-result').html(ui.value);
    }
});
$('#slider-result').html($('#slider').slider('option', 'value'));

jsFiddle

1
  • I think there's no way to do that (without modify sources) Commented Jan 7, 2013 at 13:45

1 Answer 1

1

You could keep step at 1, and in change -event, if the selected value is not a multiple of 75 (value % 75 != 0), add (or subtract..) the reminder to the value to get a multiple of 75, and set it as the value.

Then add exceptions for those two specific values that are not multiples of 75.

And propably you want some kind of buttons (in either end of the slider) that set the slider to your two magic values.

You don't give the details about why you would want this functionality, so it is difficult to say what would be best usability-wise.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.