noUiSlider provides a steps
API to determine the previous and next steps for a handle. In this example, pressing the keyboard arrow keys will increase/decrease the slider by one step.
Use of this API is not necessary for linear sliders, as the step is constant in that case.
We'll listen to keydown on the input element, and pass the event to a function so we can read the code that identifies the key.
Note that the slider value will be a string
, so we'll need to parse it to an integer.
keypress
on the input