Reputation: 10981
I want to build a javascript
function on my website to switch the text color within a grey scale of colors. I've searched on google but found nothing as I wanted it. What do I go about creating the range (probably calculated from a start
and end
values) and reading the user input's on a slider to know what to do?
Cheers!
Upvotes: 0
Views: 1258
Reputation: 49425
I didn't find any ready-made solutions, but you can use the Slider control from jQueryI UI to create a one-dimensional color picker. I put together a quick jsfiddle to demonstrate. When the user moves the slider, the "slide" event fires and my function changes the background color of a div. You can change the styling of the slider and the #color div to suit your needs.
Upvotes: 2