-
Notifications
You must be signed in to change notification settings - Fork 8
/
21-events.html
109 lines (91 loc) · 3.43 KB
/
21-events.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<title>Events | Tool Cool Range Slider</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<h1 style="margin-bottom: 0">Events</h1>
<p class="desc">Open the developer toolbar to see the events.</p>
<div class="wrapper">
<div class="row">
<tc-range-slider
id="slider-1"
slider-width="100%"
generate-labels="true"
min="0"
max="100"
value="50"></tc-range-slider>
</div>
<div class="row">
<tc-range-slider
id="slider-2"
slider-width="100%"
generate-labels="true"
min="0"
max="100"
value1="30"
value2="70"></tc-range-slider>
</div>
</div>
<script src="../dist/plugins/tcrs-generated-labels.min.js"></script>
<script src="../dist/toolcool-range-slider.min.js"></script>
<script>
const $slider1 = document.getElementById('slider-1');
// change event ------------
$slider1.addEventListener('change', (evt) => {
console.log(`Change event:`, evt.detail)
});
// onMouseDown event ------------
$slider1.addEventListener('onMouseDown', (evt) => {
const nativeEvent = evt.detail.nativeEvent;
console.log('Native mousedown event:', nativeEvent)
});
// onMouseUp event ------------
$slider1.addEventListener('onMouseUp', (evt) => {
const nativeEvent = evt.detail.nativeEvent;
console.log('Native mouseup event:', nativeEvent);
});
// onPointerClicked event ------------
$slider1.addEventListener('onPointerClicked', (evt) => {
const $pointer = evt.detail.$pointer;
console.log('Pointer clicked event:', $pointer);
});
// onKeyDownEvent event ------------
$slider1.addEventListener('onKeyDown', (evt) => {
const nativeEvent = evt.detail.nativeEvent;
console.log('Native onKeyDown event:', nativeEvent);
});
</script>
<!-- 2 pointers -->
<script>
const $slider2 = document.getElementById('slider-2');
// change event ------------
$slider2.addEventListener('change', (evt) => {
console.log(`Change event:`, evt.detail)
});
// onMouseDown event ------------
$slider2.addEventListener('onMouseDown', (evt) => {
const nativeEvent = evt.detail.nativeEvent;
console.log('Native mousedown event:', nativeEvent)
});
// onMouseUp event ------------
$slider2.addEventListener('onMouseUp', (evt) => {
const nativeEvent = evt.detail.nativeEvent;
console.log('Native mouseup event:', nativeEvent);
});
// onPointerClicked event ------------
$slider2.addEventListener('onPointerClicked', (evt) => {
const $pointer = evt.detail.$pointer;
console.log('Pointer clicked event:', $pointer);
});
// onKeyDownEvent event ------------
$slider2.addEventListener('onKeyDown', (evt) => {
const nativeEvent = evt.detail.nativeEvent;
console.log('Native onKeyDown event:', nativeEvent);
});
</script>
</body>
</html>