当前位置:   article > 正文

基于layer mobile手机端弹出框,询问框(PC端推荐layer和artDialog:http://download.csdn.net/download/cometwo/9437895)...

layer for mobile官网

layer mobile是为移动设备(手机、平板等webkit内核浏览器/webview)量身定做的弹层支撑,采用Native JavaScript编写,完全独立于PC版的layer,您需要按照场景选择使用。 官方地址:http://layer.layui.com/mobile/ 下载地址:http://download.csdn.net/detail/cometwo/9441001

这里写图片描述
这里写图片描述

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  6. <meta content="yes" name="apple-mobile-web-app-capable">
  7. <meta content="black" name="apple-mobile-web-app-status-bar-style">
  8. <meta content="telephone=no" name="format-detection">
  9. <meta content="email=no" name="format-detection">
  10. <meta http-equiv="refresh" content="100">
  11. <title>手机</title>
  12. <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
  13. <link rel="stylesheet" href="css/layer.css" />
  14. <script type="text/javascript" src="js/fastclick.js"></script>
  15. <script type="text/javascript" src="js/layer.js"></script>
  16. <style type="text/css">
  17. input {
  18. width: auto;
  19. padding: 10px;
  20. line-height: 20px;
  21. background: red;
  22. border: 1px solid blue;
  23. margin: 10px;
  24. }
  25. </style>
  26. <script type="text/javascript">
  27. FastClick.attach(document.body);
  28. $(function() {
  29. $('.btn1').click(function() {
  30. layer.open({
  31. content: '您好',
  32. anim: true,
  33. time: 2 //2秒后自动关闭
  34. });
  35. });
  36. $('.btn2').click(function() {
  37. layer.open({
  38. content: '通过style设置你想要的样式',
  39. style: 'background-color:#09C1FF; color:#fff; border:none;margin: 0px;',
  40. time: 2
  41. });
  42. });
  43. $('.btn3').click(function() {
  44. layer.open({
  45. title: [
  46. '我是标题',
  47. 'background-color:#fff; color:#000;'
  48. ],
  49. cancel: function() {
  50. layer.open({
  51. content: '你点了x',
  52. time: 1
  53. });
  54. },
  55. btn: ['确认', '取消'],
  56. shadeClose: false, //默认:true,是否点击遮罩时关闭层
  57. yes: function() {
  58. layer.open({
  59. content: '你点了确认',
  60. time: 1
  61. });
  62. },
  63. no: function() {
  64. layer.open({
  65. content: '你选择了取消',
  66. time: 1
  67. });
  68. },
  69. content: '标题风格任你定义。。'
  70. });
  71. });
  72. $('.btn4').click(function() {
  73. layer.open({
  74. // title: [
  75. // '我是标题',
  76. // 'background-color:#8DCE16; color:#fff;'
  77. // ],
  78. content: '通过style设置你想要的样式',
  79. btn: ['OK']
  80. });
  81. });
  82. $('.btn5').click(function() {
  83. layer.open({
  84. content: '你是想确认呢,还是想取消呢?你是想确认呢,还是想取消呢?你是想确认呢,还是想取消呢?',
  85. btn: ['确认', '取消'],
  86. shadeClose: false, //默认:true,是否点击遮罩时关闭层
  87. yes: function() {
  88. layer.open({
  89. content: '你点了确认',
  90. time: 1
  91. });
  92. },
  93. no: function() {
  94. layer.open({
  95. content: '你选择了取消',
  96. time: 1
  97. });
  98. }
  99. });
  100. });
  101. $('.btn6').click(function() {
  102. layer.open({
  103. title: '信息',
  104. content: '移动版和PC版不能同时使用在同一页面。'
  105. });
  106. });
  107. $('.btn7').click(function() {
  108. layer.open({
  109. title: '提示',
  110. content: '您确定要刷新一下本页面吗?',
  111. btn: ['嗯', '不要'],
  112. yes: function(index) {
  113. location.reload();
  114. layer.close(index);
  115. }
  116. });
  117. });
  118. $('.btn8').click(function() {
  119. layer.open({
  120. type: 1,
  121. content: '<img src="img/layer-mobile.png">'
  122. })
  123. });
  124. $('.btn9').click(function() {
  125. layer.open({
  126. type: 1,
  127. content: '可传入任何内容,支持html。一般用于手机页面中',
  128. anim: 0,
  129. style: 'position:fixed; bottom:0; left:0; width:100%; height:150px; padding:10px 30px; border:none;color:red'
  130. });
  131. });
  132. $('.btn10').click(function() {
  133. layer.open({
  134. type: 2
  135. //,shade: false
  136. ,
  137. time: 5
  138. //,content: '加载测试中…'
  139. });
  140. });
  141. })
  142. </script>
  143. </head>
  144. <body>
  145. <input type="button" class="btn1" value="弹出框1" />
  146. <input type="button" class="btn2" value="弹出框2" />
  147. <input type="button" class="btn3" value="弹出框3" />
  148. <input type="button" class="btn4" value="弹出框4" />
  149. <input type="button" class="btn5" value="弹出框5" />
  150. <input type="button" class="btn6" value="信息框" />
  151. <input type="button" class="btn7" value="询问框" />
  152. <input type="button" class="btn8" value="二维码" />
  153. <input type="button" class="btn9" value="页面层" />
  154. <input type="button" class="btn10" value="加载条" />
  155. </body>
  156. </html>
  157. <!DOCTYPE html>
  158. <html>
  159. <head>
  160. <meta charset="utf-8" />
  161. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  162. <meta content="yes" name="apple-mobile-web-app-capable">
  163. <meta content="black" name="apple-mobile-web-app-status-bar-style">
  164. <meta content="telephone=no" name="format-detection">
  165. <meta content="email=no" name="format-detection">
  166. <meta http-equiv="refresh" content="100">
  167. <title>手机</title>
  168. <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
  169. <link rel="stylesheet" href="css/layer.css" />
  170. <script type="text/javascript" src="js/fastclick.js"></script>
  171. <script type="text/javascript" src="js/layer.js"></script>
  172. <style type="text/css">
  173. input {
  174. width: auto;
  175. padding: 10px;
  176. line-height: 20px;
  177. background: red;
  178. border: 1px solid blue;
  179. margin: 10px;
  180. }
  181. </style>
  182. <script type="text/javascript">
  183. FastClick.attach(document.body);
  184. $(function() {
  185. $('.btn1').click(function() {
  186. layer.open({
  187. content: '您好',
  188. anim: true,
  189. time: 2 //2秒后自动关闭
  190. });
  191. });
  192. $('.btn2').click(function() {
  193. layer.open({
  194. content: '通过style设置你想要的样式',
  195. style: 'background-color:#09C1FF; color:#fff; border:none;margin: 0px;',
  196. time: 2
  197. });
  198. });
  199. $('.btn3').click(function() {
  200. layer.open({
  201. title: [
  202. '我是标题',
  203. 'background-color:#fff; color:#000;'
  204. ],
  205. cancel: function() {
  206. layer.open({
  207. content: '你点了x',
  208. time: 1
  209. });
  210. },
  211. btn: ['确认', '取消'],
  212. shadeClose: false, //默认:true,是否点击遮罩时关闭层
  213. yes: function() {
  214. layer.open({
  215. content: '你点了确认',
  216. time: 1
  217. });
  218. },
  219. no: function() {
  220. layer.open({
  221. content: '你选择了取消',
  222. time: 1
  223. });
  224. },
  225. content: '标题风格任你定义。。'
  226. });
  227. });
  228. $('.btn4').click(function() {
  229. layer.open({
  230. // title: [
  231. // '我是标题',
  232. // 'background-color:#8DCE16; color:#fff;'
  233. // ],
  234. content: '通过style设置你想要的样式',
  235. btn: ['OK']
  236. });
  237. });
  238. $('.btn5').click(function() {
  239. layer.open({
  240. content: '你是想确认呢,还是想取消呢?你是想确认呢,还是想取消呢?你是想确认呢,还是想取消呢?',
  241. btn: ['确认', '取消'],
  242. shadeClose: false, //默认:true,是否点击遮罩时关闭层
  243. yes: function() {
  244. layer.open({
  245. content: '你点了确认',
  246. time: 1
  247. });
  248. },
  249. no: function() {
  250. layer.open({
  251. content: '你选择了取消',
  252. time: 1
  253. });
  254. }
  255. });
  256. });
  257. $('.btn6').click(function() {
  258. layer.open({
  259. title: '信息',
  260. content: '移动版和PC版不能同时使用在同一页面。'
  261. });
  262. });
  263. $('.btn7').click(function() {
  264. layer.open({
  265. title: '提示',
  266. content: '您确定要刷新一下本页面吗?',
  267. btn: ['嗯', '不要'],
  268. yes: function(index) {
  269. location.reload();
  270. layer.close(index);
  271. }
  272. });
  273. });
  274. $('.btn8').click(function() {
  275. layer.open({
  276. type: 1,
  277. content: '<img src="img/layer-mobile.png">'
  278. })
  279. });
  280. $('.btn9').click(function() {
  281. layer.open({
  282. type: 1,
  283. content: '可传入任何内容,支持html。一般用于手机页面中',
  284. anim: 0,
  285. style: 'position:fixed; bottom:0; left:0; width:100%; height:150px; padding:10px 30px; border:none;color:red'
  286. });
  287. });
  288. $('.btn10').click(function() {
  289. layer.open({
  290. type: 2
  291. //,shade: false
  292. ,
  293. time: 5
  294. //,content: '加载测试中…'
  295. });
  296. });
  297. })
  298. </script>
  299. </head>
  300. <body>
  301. <input type="button" class="btn1" value="弹出框1" />
  302. <input type="button" class="btn2" value="弹出框2" />
  303. <input type="button" class="btn3" value="弹出框3" />
  304. <input type="button" class="btn4" value="弹出框4" />
  305. <input type="button" class="btn5" value="弹出框5" />
  306. <input type="button" class="btn6" value="信息框" />
  307. <input type="button" class="btn7" value="询问框" />
  308. <input type="button" class="btn8" value="二维码" />
  309. <input type="button" class="btn9" value="页面层" />
  310. <input type="button" class="btn10" value="加载条" />
  311. </body>
  312. </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
  • 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
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/93361
推荐阅读
相关标签
  

闽ICP备14008679号