diff --git a/documentation/examples-content/colorpicker.php b/documentation/examples-content/colorpicker.php index f588d624..2219ef62 100644 --- a/documentation/examples-content/colorpicker.php +++ b/documentation/examples-content/colorpicker.php @@ -5,7 +5,9 @@
We'll initialize all sliders with the same options, and use the slide
callback to keep to color in sync with the slider values. This callback fires when the slider is moved by sliding, or when it is clicked or tapped.
We'll initialize all sliders with the same options, and use the update
callback to keep to color in sync with the slider values.
This callback fires any time a slider value updates.
<div id="colorpicker">
- <div class="sliders" id="red"></div>
- <div class="sliders" id="green"></div>
- <div class="sliders" id="blue"></div>
-
- <div class="result"></div>
-</div>
-
- setColor
functionAs all dates in JavaScript can be represented as time, noUiSlider can handle them, too. This example will show you how to convert dates to numerical ranges, and then use the update
event to display them in a pretty format.
This example shows how to convert dates to numerical ranges, and then use the update
event to display them in a pretty format.
We'll be creating timestamps from strings. In order to do this easily, we'll define a new helper function. This function accepts a string, creates a new Date
and then returns it as a timestamp.
In in overview below you'll find the code used to run this example. For readability, all helper functions have been moved into their own tab.
-If you are working with arbitrarily large numbers, you should not use these directly in noUiSlider, as you'll run into some JavaScript limitations. Instead, you should map your values to an array
.
If you are working with arbitrarily large numbers, you should not use these directly in noUiSlider as you'll run into some JavaScript limitations. Instead, you should map your values to an array of string values.
-Numbers is JavaScript are Double Precision Floats, which can store numbers up to 2^53 (9007199254740992) precisely. For reference, see this StackOverflow question, or issue #427 filed on GitHub.
+Numbers is JavaScript are "double precision floats", which can store numbers up to 2^53 (9007199254740992) precisely.
+ +For reference, see this StackOverflow question, or issue #427 filed on GitHub.
-As an example, see the 'range'
option for a RAM selector offering 14 steps from 512MB to 8GB. The 'step'
are ommited for clarity. The values are provided as bytes. A better solution would be to abstract the byte values away from the slider, looking up the byte values in an array. This keeps the slider configuration simple and prevents issues with floating point precision.
As an example, see the 'range'
option for a RAM selector offering 14 steps from 512MB to 8GB. The 'step'
are omitted for clarity. The values are provided as bytes.
A better solution would be to abstract the byte values away from the slider, looking up the byte values in an array. This keeps the slider configuration simple and prevents issues with floating point precision.
(These values fit within the limit just fine, but demonstrate the point really well!)
diff --git a/documentation/examples-content/keyboard.php b/documentation/examples-content/keyboard.php index c67c9208..dd568dec 100644 --- a/documentation/examples-content/keyboard.php +++ b/documentation/examples-content/keyboard.php @@ -5,7 +5,7 @@Much like the keypress example, handles can be made keyboard-focusable.
+Handles can be focused, but noUiSlider does not offer keyboard support by default. It can be added by adding a keypress
listener on a handle.
To keep the library small, features like keyboard interaction haven't been included. However, adding features to input fields linked to a slider is easy. noUiSlider provides API's to help you. In this example, pressing the keyboard arrow keys will increase/decrease the slider by one step.
+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.
This example uses the 'step'
API to determine by how much the slider should be changed. You don't need this function if your slider is linear. In that case, increase/decrease the value with the ammount of your 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-with-keypress'
element, and pass the event to a function so we can read the code that identifies the key.
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.
One of noUiSlider's core features is the ability to divide the range in a non-linear fashion. Stepping can be applied. The example on the right shows where the handles are on the slider range in values and percentages.
+One of noUiSlider's core features is the ability to divide the range in a non-linear fashion. Stepping can be applied. This example shows where the handles are on the slider range in values and percentages.