-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
executable file
·51 lines (43 loc) · 1.26 KB
/
demo.html
File metadata and controls
executable file
·51 lines (43 loc) · 1.26 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html>
<head lang="en">
<meta charset="utf-8" />
<title>Demo - range.js</title>
<link rel="stylesheet" href="range.css" />
</head>
<body>
<label for="input">Rate us:</label>
<input type="range" min="-10" max="10" step="1" id="input" />
<output id="output"></output>
<script src="range.js"></script>
<script>
const inputElement = document.getElementById('input');
const outputElement = document.getElementById('output');
const range = new Range(inputElement, outputElement, () => {
// "on init" callback
console.debug("range.js has been successfully initialized.");
});
// to set a value
range.setValue(7);
// to get a value
const value = range.getValue();
console.log(value);
// "on click" callback
range.onClick(() => {
// do something on click
});
// "on slide" callback
range.onSlide(() => {
// do something on slide
});
// "on value change" callback
range.onValueChange(() => {
// do something only when a value has been changed
});
// "on slide end" callback
range.onSlideEnd(() => {
// do something on slide end
});
</script>
</body>
</html>