kimi
2021-02-18 749a5510a9f014446a3cd6ba57b3cb0cc8148dc1
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<!DOCTYPE html>
<html>
 
    <head>
        <meta charset="utf-8">
        <title>Hello MUI</title>
        <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
 
        <link rel="stylesheet" href="../css/mui.min.css">
        <style>
            html,
            body {
                min-height: 100%;
                background-color: #efeff4;
            }
            .animated {
                -webkit-animation-duration: 0.5s;
                animation-duration: 0.5s;
                -webkit-animation-fill-mode: both;
                animation-fill-mode: both;
            }
            @-webkit-keyframes bounceInDown {
                0%, 60%, 75%, 90%, 100% {
                    -webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                    transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                }
                0% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
                60% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 25px, 0);
                    transform: translate3d(0, 25px, 0);
                }
                75% {
                    -webkit-transform: translate3d(0, -10px, 0);
                    transform: translate3d(0, -10px, 0);
                }
                90% {
                    -webkit-transform: translate3d(0, 5px, 0);
                    transform: translate3d(0, 5px, 0);
                }
                100% {
                    -webkit-transform: none;
                    transform: none;
                }
            }
            @keyframes bounceInDown {
                0%, 60%, 75%, 90%, 100% {
                    -webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                    transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                }
                0% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
                60% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 25px, 0);
                    transform: translate3d(0, 25px, 0);
                }
                75% {
                    -webkit-transform: translate3d(0, -10px, 0);
                    transform: translate3d(0, -10px, 0);
                }
                90% {
                    -webkit-transform: translate3d(0, 5px, 0);
                    transform: translate3d(0, 5px, 0);
                }
                100% {
                    -webkit-transform: none;
                    transform: none;
                }
            }
            .bounce-in-down {
                -webkit-animation-name: bounceInDown;
                animation-name: bounceInDown;
            }
            @-webkit-keyframes fadeInDown {
                0%, 60%, 75%, 90%, 100% {
                    -webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                    transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                }
                0% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
                60% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                75% {
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                90% {
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                100% {
                    -webkit-transform: none;
                    transform: none;
                }
            }
            @keyframes fadeInDown {
                0%, 60%, 75%, 90%, 100% {
                    -webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                    transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                }
                0% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
                60% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                75% {
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                90% {
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                100% {
                    -webkit-transform: none;
                    transform: none;
                }
            }
            .fade-in-down {
                -webkit-animation-name: fadeInDown;
                animation-name: fadeInDown;
            }
            @-webkit-keyframes bounceOutUp {
                20% {
                    -webkit-transform: translate3d(0, -10px, 0);
                    transform: translate3d(0, -10px, 0);
                }
                40%,
                45% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 20px, 0);
                    transform: translate3d(0, 20px, 0);
                }
                100% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
            }
            @keyframes bounceOutUp {
                20% {
                    -webkit-transform: translate3d(0, -10px, 0);
                    transform: translate3d(0, -10px, 0);
                }
                40%,
                45% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 20px, 0);
                    transform: translate3d(0, 20px, 0);
                }
                100% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
            }
            .bounce-out-up {
                -webkit-animation-name: bounceOutUp;
                animation-name: bounceOutUp;
            }
            @-webkit-keyframes fadeOutUp {
                20% {
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                40%,
                45% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                100% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
            }
            @keyframes fadeOutUp {
                20% {
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                40%,
                45% {
                    opacity: 1;
                    -webkit-transform: translate3d(0, 0px, 0);
                    transform: translate3d(0, 0px, 0);
                }
                100% {
                    opacity: 0;
                    -webkit-transform: translate3d(0, -100%, 0);
                    transform: translate3d(0, -100%, 0);
                }
            }
            .fade-out-up {
                -webkit-animation-name: fadeOutUp;
                animation-name: fadeOutUp;
            }
            .menu-open {
                height: 100%;
                width: 100%;
            }
            .menu-open .mui-scroll-wrapper {
                position: absolute;
                top: 48;
                bottom: 0;
                left: 0;
                z-index: 1;
                width: 100%;
                overflow: hidden;
                -webkit-backface-visibility: hidden;
            }
            .menu-backdrop {
                display: none;
            }
            .menu-open .menu-backdrop {
                position: fixed;
                top: 0;
                bottom: 0;
                height: 100%;
                width: 100%;
                display: block;
                z-index: 998;
            }
            .menu-wrapper {
                position: absolute;
                top: 48px;
                left: 0;
                right: 0;
                z-index: 999;
                text-align: center;
                background-color: #333;
                width: 100%;
            }
            .menu-wrapper.hidden {
                -webkit-transform: translate3d(0, -100%, 0);
                transform: translate3d(0, -100%, 0);
                z-index: -1;
            }
            .menu {
                width: 100%;
            }
            .menu .mui-table-view-inverted {
                color: gray;
                font-size: 19px;
            }
            .menu .mui-table-view-inverted .mui-table-view-cell:after {
                height: 2px;
                left: 0;
                right: 0;
            }
            .menu-wrapper.mui-active,
            .menu-wrapper.mui-active .menu {
                -webkit-transform: translate3d(0, 0, 0);
                transform: translate3d(0, 0, 0);
            }
            #info{
                  padding: 20px 10px ;
             }
        </style>
    </head>
 
    <body>
        <header class="mui-bar mui-bar-nav">
            <a id="icon-menu" class="mui-action-menu mui-icon mui-icon-bars mui-pull-left"></a>
            <a class="mui-action-back mui-btn mui-btn-link mui-pull-right">关闭</a>
            <h1 class="mui-title">div模式下拉菜单</h1>
        </header>
        <div class="mui-content">
            <div class="mui-content-padded" >
                <p>这是div模式下沉菜单示例,主页面和菜单在一个HTML文件中,
                    
                    当前页面为主界面,你可以在主界面放置任何内容;
                     打开侧滑菜单有多种方式:  1、点击页面左上角的
                    <span class="mui-icon mui-icon-bars"></span> 图标;
                     2、通过JS API触发(例如点击如下蓝色按钮体验);
                     <span class="android-only">3、Android手机按menu键;</span>
                </p>
                <p style="padding: 5px 20px;margin-bottom: 5px;">
                    <button id="menu-btn" type="button" class="mui-btn mui-btn-primary mui-btn-block" style="padding: 10px;">
                        显示下拉菜单
                    </button>
                </p>
                <div id="info"></div>
            </div>
            
        </div>
        <div id="menu-wrapper" class="menu-wrapper hidden">
            <div id="menu" class="menu">
                <ul class="mui-table-view mui-table-view-inverted">
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 1</a>
                    </li>
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 2</a>
                    </li>
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 3</a>
                    </li>
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 4</a>
                    </li>
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 5</a>
                    </li>
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 6</a>
                    </li>
                    <li class="mui-table-view-cell">
                        <a href="javascript:;">Item 7</a>
                    </li>
                </ul>
            </div>
        </div>
        <div id="menu-backdrop" class="menu-backdrop"></div>
        <script src="../js/mui.min.js"></script>
        <script>
            mui.init({
                swipeBack:true //启用右滑关闭功能
            });
            var menuWrapper = document.getElementById("menu-wrapper");
            var menu = document.getElementById("menu");
            var menuWrapperClassList = menuWrapper.classList;
            var backdrop = document.getElementById("menu-backdrop");
            var info = document.getElementById("info");
            
            backdrop.addEventListener('tap', toggleMenu);
            document.getElementById("menu-btn").addEventListener('tap', toggleMenu);
            document.getElementById("icon-menu").addEventListener('tap',toggleMenu)
            //下沉菜单中的点击事件
            mui('#menu').on('tap', 'a', function() {
                toggleMenu();
                info.innerHTML = '你已选择:'+this.innerHTML;
            });
            var busying = false;
 
            function toggleMenu() {
                if (busying) {
                    return;
                }
                busying = true;
                if (menuWrapperClassList.contains('mui-active')) {
                    document.body.classList.remove('menu-open');
                    menuWrapper.className = 'menu-wrapper fade-out-up animated';
                    menu.className = 'menu bounce-out-up animated';
                    setTimeout(function() {
                        backdrop.style.opacity = 0;
                        menuWrapper.classList.add('hidden');
                    }, 500);
                } else {
                    document.body.classList.add('menu-open');
                    menuWrapper.className = 'menu-wrapper fade-in-down animated mui-active';
                    menu.className = 'menu bounce-in-down animated';
                    backdrop.style.opacity = 1;
                }
                setTimeout(function() {
                    busying = false;
                }, 500);
            }
        </script>
    </body>
 
</html>