New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom step values #53
Comments
The example is a good one - I'll add it to the documentation. I'm not sure why I would add this functionality to the plugin core, since it would barely save any effort implementing the plugin, while increasing the file size even for those that don't need this. I'm -very- open for counter-arguments, though! |
Well, my only argument is to keep it simple for the users that want such functionality. It's not a lot of extra code, but if you want to get the slider values you need the extra boilerplate code. I guess it depends on how common this use case is among the users of the library. |
I always use array and use the slide value as array index to get my value. Works well. |
This is what I need for, as example I use the slider for getting input of date, I know some will say use calendar, but in my condition I need to use slider because the UI are far more better because the value of selections are little. Allowing us to specify or change the value I think will make it far more better. |
Sure @rained23 but the complexity gotta go somewhere, either its in noUiSlider or in your app. By just having an array/object that maps values from 0-n we can avoid such complexity |
var dates = ['21-06-2013','22-06-2013','23-06-2013','24-06-2013','25-06-2013','26-06-2013'];
$('#slider').noUiSlider({
range: [0,5],
,start: 3
,handles: 1
,slide: function(){
alert(dates[parseInt($(this).val())]);
}
}); There you go! I see no reason to add this to the plugin, as this required just 2 lines of 'local' code. |
@leongersen Thank you for the example code, it's working for me. However, this still makes the slider steps seem linear visually, and I think that custom steps would still be useful for the UI. |
I've decided to close the issue, as adding it to the plugin is likely to just miss everyone's exact requirements by a hair. This'll just require making other 'local' changes, and add an unnecessary layer of complexity. If you really, Really, Really, don't agree; feel free to comment again, and we'll talk some more :) |
I would recommend this one: http://loopj.com/jquery-simple-slider/ demo page: (look at Predefined List & Snap) http://loopj.com/jquery-simple-slider/demo.html Personally I don't think it's a waste to include this feature |
This feature is currently in active development, see issue #140. |
Nice to hear ! |
I answered from a smartphone last night, didn't get a chance to properly look at the example you provided. The 'Predefined List & Snap' functionality is currently available by mapping to an array. The feature discussed in #140 looks to be more advanced. I'll take more basic needs in consideration too, though. |
@leongersen Hey Leon. Not really clear on how to create the "Predefined List & Snap" functionality with v6. Our price dropdowns have irregular, unevenly spaced values and I would like to make the Example of our price values:
|
Yes: here you go: http://jsfiddle.net/leongersen/SGVEv/ It uses the |
@leongersen This is fantastic! Thanks for taking the time to answer. |
👍 🆒 🎊 |
|
Actually, the fiddle was made before |
The jsfiddle does not work anymore. I tried to fix the link to the js and css but I cannot find the Link.js. Is this supposed to work? |
@ChrisCinelli Maybe try this ad-hoc fiddle based on the new api: Apparently Link.js is part of the .min version of the plugin; or was Link.js altogether removed? |
@mg1075 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The current
step
option, allows for linear values in the slider. It would be nice if the slider allowed a custom array of values. I can think of two use cases for this option:100, 200, 500, 1000, 2000, 5000, 10000
"never", "rarely", "sometimes", "often"
Both cases can be implemented with a custom
slide
function, but it would be nice if this functionality was built-in. Here's a jsfiddle with the above examples: http://jsfiddle.net/KheWe/The text was updated successfully, but these errors were encountered: