Skip to content

Commit

Permalink
Add getPositions method
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Aug 14, 2021
1 parent c2fc112 commit 757901f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions documentation/reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@
<td><code>slider.noUiSlider.removeTooltips()</code></td>
<td><em>[none]</em></td>
</tr>
<tr>
<td><a href="/nouislider/slider-read-write/#section-positions">getPositions</a></td>
<td><code>slider.noUiSlider.getPositions()</code></td>
<td><em>[none]</em></td>
</tr>
</tbody>
</table>
</div>
Expand Down
16 changes: 16 additions & 0 deletions documentation/slider-read-write.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,22 @@
</section>


<?php sect('positions'); ?>
<h2>Positions</h2>

<section>

<div class="view">
<p>To get the current positions for the slider handles (in percentages from the left of the slider), the <code>getPositions</code> method can be used. This matches the <a href="/nouislider/events-callbacks/#section-binding">positions parameter</a> in the slider's events.</p>
</div>

<div class="side">
<?php code('positions'); ?>
</div>

</section>


<?php sect('formatting'); ?>
<h2>Number formatting</h2>

Expand Down
1 change: 1 addition & 0 deletions documentation/slider-read-write/positions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
slider.noUiSlider.getPositions();
3 changes: 3 additions & 0 deletions src/nouislider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down

0 comments on commit 757901f

Please sign in to comment.