freqdec / fd-slider

An Unobtrusive Accessible Slider script that can also be used as an HTML5 Input Range polyfill solution
Other
264 stars 55 forks source link

Value custom formatting #14

Closed mourner closed 12 years ago

mourner commented 12 years ago

It would be great to be able to easily format the value in aria-valuetext with a custom function, e.g. by passing a formatter function to options when initializing the slider. This is especially useful for sliders with non-numerical semantics, e.g. time slider or year date slider.

By the way, awesome work! I've been thinking about writing such a component but found yours to be just about perfect! Thanks a lot! Going to use this for the next version of http://suncalc.net/.

mourner commented 12 years ago

Another way to approach this is an ability to set formatting and parsing of the value for the input itself, so that if the input is not hidden, the value would be shown formatted instead of raw numeric value.

freqdec commented 12 years ago

Hi mourner,

Nice idea about passing a formatter function... so much so that I've just added it to the code. Changing the input value is trickier as you would also have to provide a parser (and also be able to parse this value on the server I imagine).

I've rewritten the CSS file completely and updated the script to enable much better styling opportunities across all browsers (even in .oldie IE). I really want to check the current version in .oldie IE before updating here at github though which means waiting a few days unfortunately.

Thanks for the aria suggestion!

freqdec commented 12 years ago

Added to the code as a creation parameter named ariaFormat. Thanks again.