weather.html
3.52 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/JavaScript.js"></script>
<script src="../../js/popupJS.js"></script>
<link rel="stylesheet" href="../../css/layer.css">
<script src="/static/js/layui/layui.js"></script>
<link rel="stylesheet" href="/static/js/layui/css/layui.css">
<style>
.row {
margin-top: 5px;
}
.demo-slider {
width: 200px;
}
</style>
</head>
<body marginwidth="0" marginheight="0">
<div id="mainDiv" class="dialog tianqi">
<h1 class="title" onmousedown="MouseDown(event)" onmouseup="MouseUp(event)" onmouseout="MouseUp(event)">
天气<i class="guanbibtn" onclick="Close()">X</i>
</h1>
<form class="layui-form" action="">
<div class="main">
<div class="row">
<input type="checkbox" name="weather[fog]" lay-filter="fog" title="雾">
<div class="demo-slider" id="slideFog"></div>
</div>
<div class="row">
<input type="checkbox" name="weather[rain]" lay-filter="rain" title="雨">
<div class="demo-slider" id="slideRain"></div>
</div>
<div class="row">
<input type="checkbox" name="weather[snow]" lay-filter="snow" title="雪">
<div class="demo-slider" id="slideSnow"></div>
</div>
</div>
</form>
</div>
</body>
<script>
layui.use(['form', 'slider'], function () {
var form = layui.form;
var $ = layui.$;
var slider = layui.slider;
var sgworld = CreateSGObj();
form.on('checkbox(fog)', function (data) {
// console.log(data.elem); //得到checkbox原始DOM对象
// console.log(data.elem.checked); //是否被选中,true或者false
// console.log(data.value); //复选框value值,也可以通过data.elem.value得到
// console.log(data.othis); //得到美化后的DOM对象
if (data.elem.checked) {
sgworld.Command.Execute(2208, 1);
} else {
sgworld.Command.Execute(2208, 0);
}
});
slider.render({
elem: '#slideFog'
, min: 0 //最小值
, max: 100 //最大值
, change: function (value) {
sgworld.Command.Execute(2204, value);
}
});
form.on('checkbox(rain)', function (data) {
if (data.elem.checked) {
sgworld.Command.Execute(2206, 1);
} else {
sgworld.Command.Execute(2206, 0);
}
});
slider.render({
elem: '#slideRain'
, min: 20 //最小值
, max: 100 //最大值
, change: function (value) {
sgworld.Command.Execute(2200, value);
}
});
form.on('checkbox(snow)', function (data) {
if (data.elem.checked) {
sgworld.Command.Execute(2207, 1);
} else {
sgworld.Command.Execute(2207, 0);
}
});
slider.render({
elem: '#slideSnow'
, min: 20 //最小值
, max: 100 //最大值
, change: function (value) {
sgworld.Command.Execute(2201, value);
}
});
});
</script>
</html>