-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselectLunch.html
167 lines (149 loc) · 5.45 KB
/
selectLunch.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>选午餐</title>
<style>
html,
body {
margin: 0;
padding: 0;
}
html {
padding: 20px;
}
body {
width: 100%;
position: relative;
}
.animate {
transition: all ease-out 0.3s 0s;
-webkit-transition: all ease-out 0.3s 0s;
-moz-transition: all ease-out 0.3s 0s;
-ms-transition: all ease-out 0.3s 0s;
-o-transition: all ease-out 0.3s 0s;
}
.container {
width: 100%;
max-width: 600px;
margin: 0 auto;
}
.J_selectBtn {
position: relative;
width: 120px;
height: 120px;
border-radius: 50%;
border: none;
background: #07bba2;
font-size: 20px;
color: #fff;
margin: 0 auto;
text-align: center;
cursor: pointer;
animation: mymove 5s infinite;
-webkit-animation: mymove 5s infinite;
}
@keyframes mymove {
0% {
width: 120px;
box-shadow: 0 0px 10px 2px rgba(10, 187, 162, 0.25);
}
50% {
color: #ebebeb;
box-shadow: 0 0px 15px 10px rgba(10, 187, 162, 0.25);
}
100% {
width: 120px;
box-shadow: 0 0px 10px 2px rgba(10, 187, 162, 0.25);
}
}
@-webkit-keyframes mymove
/*Safari and Chrome*/
{
0% {
width: 120px;
box-shadow: 0 0px 10px 2px rgba(10, 187, 162, 0.25);
}
50% {
color: #ebebeb;
box-shadow: 0 0px 15px 10px rgba(10, 187, 162, 0.25);
}
100% {
width: 120px;
box-shadow: 0 0px 10px 2px rgba(10, 187, 162, 0.25);
}
}
.J_lunch_box {
padding: 20px;
text-align: center;
color: #FF9800;
font-size: 30px;
font-weight: bold;
border: 1px dotted #FF9800;
margin-top: 20px;
min-height: 40px;
line-height: 40px;
}
.lunch-list {
padding: 20px;
color: cadetblue;
line-height: 26px;
font-size: 16px;
}
.btn-text {
margin-top: -21px;
position: absolute;
top: 50%;
width: 100%;
text-align: center;
}
</style>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
<div class="container">
<div>
<div class="J_selectBtn animate">
<div class="btn-text">
<p style="margin: 0;">午饭抽取</p>
<p style="font-size: 12px;margin: 0;">Choosing lunch</p>
</div>
</div>
</div>
<div class="J_lunch_box animate"></div>
</div>
<p style="color: cadetblue;margin-bottom: 0;">可选类型如下:</p>
<div class="lunch-list">
16元套饭(16RMB Set meal),大蓉和(Sichuan cuisine),亲家小味(Set meal&Rice noodles),乡村基(CSC),大米先生(Chinese Fast Food),冒菜(Instant Boiled Spicy Hot Pot),真霸牛肉面(noodles),无间道(pancake&beef soup),猪脚饭(Rice with Stewed Pork),花溪米线(Rice noodles),摊摊面(noodles),老麻抄手(wonton),豆汤饭(Rice with bean soup&noodles),砂锅(Casserole)
</div>
<script>
$(document).ready(function() {
var string = "16元套饭(16RMB Set meal),大蓉和(Sichuan cuisine),亲家小味(Set meal&Rice noodles),乡村基(CSC),大米先生(Chinese Fast Food),冒菜(Instant Boiled Spicy Hot Pot),真霸牛肉面(noodles),无间道(pancake&beef soup),猪脚饭(Rice with Stewed Pork),花溪米线(Rice noodles),摊摊面(noodles),老麻抄手(wonton),豆汤饭(Rice with bean soup&noodles),砂锅(Casserole)"; //原始数据
function selectLunch() {
var array = string.split(","); //转化为数组
var value = array[Math.round(Math.random() * (array.length - 1))]; //随机抽取一个值
return value;
}
var buttonDom = $('.J_selectBtn');
buttonDom.on('click', function(e) {
var box = $('.J_lunch_box'),
value = selectLunch();
box.html('');
box.html(value);
buttonDom.unbind('click');
buttonDom.css({
background: '#057364',
cursor: 'default',
color: '#e8e8e8',
boxShadow: 'none'
})
});
});
</script>
</body>
</html>