-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch开关.html
39 lines (34 loc) · 1.01 KB
/
switch开关.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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="css/mui.min.css" rel="stylesheet" />
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">操作表</h1>
</header>
<div class="mui-content" style="margin-top: 100px;">
<div class="mui-switch" id="mySwitch">
<div class="mui-switch-handle"></div>
</div>
<!--<div class="mui-switch mui-active">
<div class="mui-switch-handle"></div>
</div>-->
</div>
<script src="js/mui.min.js"></script>
<script type="text/javascript">
mui.init();
document.getElementById("mySwitch").addEventListener("toggle", function(event) {
if(event.detail.isActive) {
console.log("你启动了开关");
} else {
console.log("你关闭了开关");
}
})
</script>
</body>
</html>