Skip to content

Commit d53446c

Browse files
author
lgersen
committed
Better example for center-fixed sliders
1 parent 44744a0 commit d53446c

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

documentation/examples-content/from-center.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55

66
<div class="view">
77

8-
<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>
9-
10-
<p>An example of how to implement this is <a href="https://jsfiddle.net/leongersen/9hyfv0bw/11/">available as a JSFiddle</a>.</p>
8+
<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.
9+
This can be implemented by hiding one of the handles and using the <code>"unconstrained"</code> behaviour.</p>
1110

11+
<div class="example">
12+
<div id="from-center"></div>
13+
<?php run('from-center'); ?>
14+
<?php run('from-center'); ?>
15+
</div>
1216
</div>
1317

1418
<div class="side">
19+
20+
<?php loadShowCSS('from-center'); ?>
21+
<?php code('from-center'); ?>
1522
</div>
1623
</section>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#from-center .noUi-handle[data-handle="0"] {
2+
display: none;
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var fromCenterSlider = document.getElementById('from-center');
2+
3+
noUiSlider.create(fromCenterSlider, {
4+
start: [50, 80],
5+
behaviour: 'unconstrained',
6+
connect: true,
7+
range: {
8+
'min': 0,
9+
'max': 100
10+
}
11+
});

0 commit comments

Comments
 (0)