File: steps.js

package info (click to toggle)
node-nouislider 15.6.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,880 kB
  • sloc: javascript: 5,123; php: 464; sh: 32; python: 28; makefile: 11
file content (34 lines) | stat: -rw-r--r-- 709 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Example slider:
noUiSlider.create(slider, {
	start: [20, 80],
	range: {
		'min': [0],
		'10%': [10, 10],
		'50%': [80, 50],
		'80%': 150,
		'max': 200
	}
});

// Both handles step 10 up and down
.set([30, 50])
.steps() => [[10,10],[10,10]]

// Second handle now steps up 50
.set([30, 80])
.steps() => [[10,10],[10,50]]

// Second handle now steps down 50, steps up 20 to
// reach 150 at 80% of the slider
.set([30, 130])
.steps() => [[10,10],[50,20]]

// Second handle steps down 20 to go back to 130.
// the is no step value to go up
.set([30, 150])
.steps() => [[10,10],[20,false]]

// Second handle has no downward step,
// is at the end of the slider
.set([30, 200])
.steps() => [[10,10],[false,null]]