Skip to content

Commit

Permalink
Better example for center-fixed sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
lgersen committed Jun 21, 2024
1 parent 44744a0 commit d53446c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
13 changes: 10 additions & 3 deletions documentation/examples-content/from-center.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@

<div class="view">

<p><a href="https://github.com/leongersen/noUiSlider/issues/371">Issue #371</a> requested a slider with the connect option originating from the slider center.</p>

<p>An example of how to implement this is <a href="https://jsfiddle.net/leongersen/9hyfv0bw/11/">available as a JSFiddle</a>.</p>
<p><a href="https://github.com/leongersen/noUiSlider/issues/371">Issue #371</a> requested a slider with the connect option originating from the slider center.
This can be implemented by hiding one of the handles and using the <code>"unconstrained"</code> behaviour.</p>

<div class="example">
<div id="from-center"></div>
<?php run('from-center'); ?>
<?php run('from-center'); ?>
</div>
</div>

<div class="side">

<?php loadShowCSS('from-center'); ?>
<?php code('from-center'); ?>
</div>
</section>
3 changes: 3 additions & 0 deletions documentation/examples/from-center.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#from-center .noUi-handle[data-handle="0"] {
display: none;
}
11 changes: 11 additions & 0 deletions documentation/examples/from-center.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var fromCenterSlider = document.getElementById('from-center');

noUiSlider.create(fromCenterSlider, {
start: [50, 80],
behaviour: 'unconstrained',
connect: true,
range: {
'min': 0,
'max': 100
}
});

0 comments on commit d53446c

Please sign in to comment.