-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
75 lines (75 loc) · 2.34 KB
/
index.html
File metadata and controls
75 lines (75 loc) · 2.34 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
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SwitchBox-JS</title>
<link href="dist/theme/switchBox.min.css" rel="stylesheet">
<link rel="shortcut icon" href="https://carry0987.github.io/favicon.png" type="image/x-icon">
</head>
<body>
<div id="app">
<h1>Individual Input</h1>
<input type="checkbox" name="switch-1">
<input type="checkbox" name="switch-2">
</div>
<hr>
<div id="app-2">
<h1>Grouped Input</h1>
<input type="checkbox" name="switch-3" title="Switch-3">
<input type="checkbox" name="switch-4">
<label data-switch-for="switch-4">Switch-4</label>
<input type="checkbox" id="switch-5" value="1">
<label data-switch-for="switch-5">Switch-5</label>
<input type="checkbox" id="switch-6">
<label for="switch-6">Switch-6</label>
</div>
<hr>
<div id="app-3">
<h1>Disabled Input</h1>
<input type="checkbox" id="switch-7">
<label for="switch-7">Switch-7</label>
</div>
<script src="dist/switchBox.min.js"></script>
<script type="text/javascript">
let switchBox1 = new switchBoxjs.SwitchBox('input[name="switch-1"]', {
title: 'Switch 1',
checked: true,
onUnchecked: function(target) {
console.log(target);
}
});
switchBox1.onChange = (target, checked) => {
console.log(checked);
};
let switchBox2 = new switchBoxjs.SwitchBox('input[name="switch-2"]', {
title: 'Switch 2',
checked: false,
onChecked: function(target) {
console.log(target);
}
});
let switchBox3 = new switchBoxjs.SwitchBox('#app-2 input', {
bindLabel: false,
checked: ['switch-3'],
checkedByValue: [1, '1'],
styles: {
'.switch-box': {'padding': '10px;'}
},
onLoad: function(switchbox) {
console.log(switchbox.elements);
}
});
switchBox3.onToggled = function(e, ele) {
console.log(e.target.checked);
console.log(ele);
};
let switchBox4 = new switchBoxjs.SwitchBox('#app-3 input', {
disabled: ['switch-7'],
styles: {
'.switch-box': {'padding': '10px;'}
}
});
</script>
</body>
</html>