forked from metro-start/metro-select
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.html
More file actions
70 lines (65 loc) · 2.06 KB
/
sample.html
File metadata and controls
70 lines (65 loc) · 2.06 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<script
src="node_modules/jquery/dist/jquery.js"
type="text/javascript"
></script>
<script src="node_modules/jss/jss.js" type="text/javascript"></script>
<script src="metro-select.js"></script>
<style type="text/css">
.ms-opt {
margin-right: 5px;
}
.sample_class {
font-style: italic;
}
.green {
color: green;
}
.added {
color: blue;
}
.removed {
color: green;
}
</style>
</head>
<body>
<div>
<select id="select-box">
<option class="removeable" style="color: red">celcius</option>
<option class="sample_class">fahrenheit</option>
<option class="removeable removed">kelvin</option>
<option class="removeable">centigrade</option>
</select>
</div>
<div>
<select>
<option class="green">celcius</option>
<option>fahrenheit</option>
</select>
</div>
<div>
<button id="set-active">Set celcius active</button>
</div>
<script type="text/javascript">
$('#select-box').metroSelect({
initial: 'fahrenheit',
option_class: 'ms-opt',
add_text: ' [s]',
parent_added_class: 'added',
parent_removed_class: 'removed',
onchange: function (a) {
console.log('change', a);
},
onvisibilitychange: function (a, b, cb) {
console.log('visibility changed', a, 'b', b);
cb(a == 'kelvin' || a == 'centigrade');
},
});
$('#set-active').on('click', function () {
$('#select-box').metroSelect().set_active('celcius');
});
</script>
</body>
</html>