diff --git a/documentation/reference.php b/documentation/reference.php index 0d75d572..39c1424b 100644 --- a/documentation/reference.php +++ b/documentation/reference.php @@ -251,6 +251,11 @@ slider.noUiSlider.removeTooltips() [none] + + getPositions + slider.noUiSlider.getPositions() + [none] + diff --git a/documentation/slider-read-write.php b/documentation/slider-read-write.php index 2b48df44..79776ec7 100644 --- a/documentation/slider-read-write.php +++ b/documentation/slider-read-write.php @@ -86,6 +86,22 @@ + +

Positions

+ +
+ +
+

To get the current positions for the slider handles (in percentages from the left of the slider), the getPositions method can be used. This matches the positions parameter in the slider's events.

+
+ +
+ +
+ +
+ +

Number formatting

diff --git a/documentation/slider-read-write/positions.js b/documentation/slider-read-write/positions.js new file mode 100644 index 00000000..a36b05ff --- /dev/null +++ b/documentation/slider-read-write/positions.js @@ -0,0 +1 @@ +slider.noUiSlider.getPositions(); diff --git a/src/nouislider.ts b/src/nouislider.ts index b2757504..32178655 100644 --- a/src/nouislider.ts +++ b/src/nouislider.ts @@ -2992,6 +2992,9 @@ function scope(target: TargetElement, options: ParsedOptions, originalOptions: O target: scope_Target, // Issue #597 removePips: removePips, removeTooltips: removeTooltips, + getPositions: function() { + return scope_Locations.slice(); + }, getTooltips: function() { return scope_Tooltips; },