NouiSlider werkt niet in android
Op de desktp werkt deze lib: https://refreshless.com/nouislider/
Prima.
Maar op de mobiel, wanneer ik dus op een menu knop wat een element vanuit rechts in laad schuiven, dan zie ik de sliderbars niet, alleen de tekst.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
noUiSlider.create(sliderDr, {
start: [0, 100],
format: wNumb({
decimals: 0
}),
tooltips: [ wNumb({decimals: 0}), true],
connect: true,
range: {
"min": 0,
"max": 100
}
});
start: [0, 100],
format: wNumb({
decimals: 0
}),
tooltips: [ wNumb({decimals: 0}), true],
connect: true,
range: {
"min": 0,
"max": 100
}
});
Heeft iemand enige idee, waarom dit niet werkt?
Staat ook op de website: "Tested in IE9 - IE11, Edge, Chrome, Firefox & Safari"
Het is een vrij oud dingetje dat nooit is getest op Android (of iOS)
Als je het toch wilt gebruiken, even contact opnemen met de ontwikkelaar of zelf fixen.
Heb deze code.
Code (php)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<style>
.range-slider {
max-width: 480px;
/* Match this to the SVG's x2 value */
margin: auto;
text-align: center;
position: relative;
height: 6em;
}
.range-slider svg,
.range-slider input[type="range"] {
position: absolute;
left: 0;
bottom: 0;
}
input[type="number"] {
border: 1px solid #ddd;
text-align: center;
font-size: 1.6em;
}
input[type="number"]:invalid,
input[type="number"]:out-of-range {
border: 2px solid #ff6347;
}
input[type="range"] {
-webkit-appearance: none;
width: 100%;
}
input[type="range"]:focus {
outline: none;
}
input[type="range"]:focus::-webkit-slider-runnable-track {
background: #2497e3;
}
input[type="range"]:focus::-ms-fill-lower {
background: #2497e3;
}
input[type="range"]:focus::-ms-fill-upper {
background: #2497e3;
}
input[type="range"]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: #2497e3;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type="range"]::-webkit-slider-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -7px;
}
input[type="range"]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: #2497e3;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type="range"]::-moz-range-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
}
input[type="range"]::-ms-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type="range"]::-ms-fill-lower,
input[type="range"]::-ms-fill-upper {
background: #2497e3;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type="range"]::-ms-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
}
</style>
<form method="post" action="slider.php">
<div class="range-slider">
<span>from <input type="number" value="25000" min="0" max="100000" step="500"> to <input type="number" value="75000" min="0" max="100000" step="500"></span>
<input name="slider-min" value="25000" min="0" max="100000" step="500" type="range">
<input name="slider-max" value="50000" min="0" max="100000" step="500" type="range">
<svg width="100%" height="24">
<line x1="4" y1="0" x2="480" y2="0" stroke="#444" stroke-width="12" stroke-dasharray="1 28"></line>
</svg>
</div>
<input type="submit" name="submit" value="submit" />
</form>
<script>
(function() {
const parent = document.querySelector('.range-slider');
if (!parent) {
return;
}
const rangeS = parent.querySelectorAll('input[type="range"]'),
numberS = parent.querySelectorAll('input[type="number"]');
rangeS.forEach((el) => {
el.oninput = () => {
let slide1 = parseFloat(rangeS[0].value),
slide2 = parseFloat(rangeS[1].value);
if (slide1 > slide2) {
[slide1, slide2] = [slide2, slide1];
}
numberS[0].value = slide1;
numberS[1].value = slide2;
}
});
numberS.forEach((el) => {
el.oninput = () => {
let number1 = parseFloat(numberS[0].value),
number2 = parseFloat(numberS[1].value);
if (number1 > number2) {
let tmp = number1;
numberS[0].value = number2;
numberS[1].value = tmp;
}
rangeS[0].value = number1;
rangeS[1].value = number2;
}
});
})();
</script>
<p>Bron : <a href="https://getbutterfly.com/how-to-create-a-price-range-slider-using-vanilla-javascript/" target="_blank">https://getbutterfly.com/how-to-create-a-price-range-slider-using-vanilla-javascript/</a></p>
.range-slider {
max-width: 480px;
/* Match this to the SVG's x2 value */
margin: auto;
text-align: center;
position: relative;
height: 6em;
}
.range-slider svg,
.range-slider input[type="range"] {
position: absolute;
left: 0;
bottom: 0;
}
input[type="number"] {
border: 1px solid #ddd;
text-align: center;
font-size: 1.6em;
}
input[type="number"]:invalid,
input[type="number"]:out-of-range {
border: 2px solid #ff6347;
}
input[type="range"] {
-webkit-appearance: none;
width: 100%;
}
input[type="range"]:focus {
outline: none;
}
input[type="range"]:focus::-webkit-slider-runnable-track {
background: #2497e3;
}
input[type="range"]:focus::-ms-fill-lower {
background: #2497e3;
}
input[type="range"]:focus::-ms-fill-upper {
background: #2497e3;
}
input[type="range"]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: #2497e3;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type="range"]::-webkit-slider-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -7px;
}
input[type="range"]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: #2497e3;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type="range"]::-moz-range-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
}
input[type="range"]::-ms-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type="range"]::-ms-fill-lower,
input[type="range"]::-ms-fill-upper {
background: #2497e3;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type="range"]::-ms-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
}
</style>
<form method="post" action="slider.php">
<div class="range-slider">
<span>from <input type="number" value="25000" min="0" max="100000" step="500"> to <input type="number" value="75000" min="0" max="100000" step="500"></span>
<input name="slider-min" value="25000" min="0" max="100000" step="500" type="range">
<input name="slider-max" value="50000" min="0" max="100000" step="500" type="range">
<svg width="100%" height="24">
<line x1="4" y1="0" x2="480" y2="0" stroke="#444" stroke-width="12" stroke-dasharray="1 28"></line>
</svg>
</div>
<input type="submit" name="submit" value="submit" />
</form>
<script>
(function() {
const parent = document.querySelector('.range-slider');
if (!parent) {
return;
}
const rangeS = parent.querySelectorAll('input[type="range"]'),
numberS = parent.querySelectorAll('input[type="number"]');
rangeS.forEach((el) => {
el.oninput = () => {
let slide1 = parseFloat(rangeS[0].value),
slide2 = parseFloat(rangeS[1].value);
if (slide1 > slide2) {
[slide1, slide2] = [slide2, slide1];
}
numberS[0].value = slide1;
numberS[1].value = slide2;
}
});
numberS.forEach((el) => {
el.oninput = () => {
let number1 = parseFloat(numberS[0].value),
number2 = parseFloat(numberS[1].value);
if (number1 > number2) {
let tmp = number1;
numberS[0].value = number2;
numberS[1].value = tmp;
}
rangeS[0].value = number1;
rangeS[1].value = number2;
}
});
})();
</script>
<p>Bron : <a href="https://getbutterfly.com/how-to-create-a-price-range-slider-using-vanilla-javascript/" target="_blank">https://getbutterfly.com/how-to-create-a-price-range-slider-using-vanilla-javascript/</a></p>
Het lijkt nu te werken, stomme fout, de URL op mobiel naar de js file was incorrect