hello.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>镜像站@快速上手 layer,新人必看</title>
  6. <link rel="stylesheet" href="../../res.layui.com/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css" media="all">
  7. <link rel="stylesheet" href="../../res.layui.com/static/css/global.css" tppabs="http://res.layui.com/static/css/global.css" media="all">
  8. <link rel="stylesheet" href="../../res.layui.com/static/css/independents.css" tppabs="http://res.layui.com/static/css/independents.css" media="all">
  9. <script src="../../other/jquery/1.12.3/jquery.min.js" tppabs="http://cdn.staticfile.org/jquery/1.12.3/jquery.min.js"></script>
  10. <script src="../../res.layui.com/layui/release/layer/dist/layer.js-v=351-1.js" tppabs="http://res.layui.com/layui/release/layer/dist/layer.js?v=330"></script>
  11. </head>
  12. <body>
  13. <div class="header">
  14. <div class="layui-main">
  15. <a class="logo" href="../index.html" tppabs="http://www.layui.com/">
  16. <img src="../../res.layui.com/static/images/layui/logo.png" tppabs="http://res.layui.com/static/images/layui/logo.png" alt="layui">
  17. </a>
  18. <ul class="layui-nav">
  19. <li class="layui-nav-item">
  20. <a href="../index.html" tppabs="http://www.layui.com/" target="_blank">layui</a>
  21. </li>
  22. <li class="layui-nav-item layui-this">
  23. <a href="http://layer.layui.com/">layer</a>
  24. </li>
  25. </ul>
  26. </div>
  27. </div>
  28. <div class="alone-banner layui-bg-black">
  29. <div class="layui-main">
  30. <h1 style="padding-top: 40px;">layer 快速上手</h1>
  31. <p>如果,你初识 layer,你对它不知所措,你甚至不知如何绑定事件… 那或许你应该用秒做单位,快速认识它</p>
  32. <p><button class="layui-btn layui-btn-normal" onclick="$('html,body').animate({scrollTop: 250}, 500);">开始了解</button></p>
  33. </div>
  34. </div>
  35. <div class="layui-main alone-nav">
  36. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  37. <ul class="layui-tab-title">
  38. <li>
  39. <a href="../index.html" tppabs="http://www.layui.com/">layer首页</a>
  40. </li>
  41. <li class="layui-this">
  42. 快速上手
  43. </li>
  44. </ul>
  45. </div>
  46. <p style="margin: 20px 0; text-align: center;">
  47. </p>
  48. <blockquote class="layui-elem-quote layui-quote-nm layui-text">
  49. 获得 layer 文件包后,解压并将 <em>layer 整个文件夹</em>(不要拆分结构) 存放到你项目的任意目录,使用时,<em>只需引入 layer.js 即可。</em> 下面是一个入门示例:
  50. </blockquote>
  51. <pre class="layui-code">
  52. <code><</code>!DOCTYPE html>
  53. <code><</code>html>
  54. <code><</code>head>
  55. &lt;meta charset="utf-8"&gt;
  56. <code><</code>title>开始使用layer<code><</code>/title>
  57. <code><</code>/head>
  58. <code><</code>body>
  59. <code><</code>script src="jQuery的路径"><code><</code>/script> &lt;!-- 你必须先引入jQuery1.8或以上版本 --&gt;
  60. <code><</code>script src="layer.js的路径"><code><</code>/script>
  61. <code><</code>script>
  62. <span id="hello1">
  63. //弹出一个提示层
  64. $('#test1').on('click', function(){
  65. layer.msg('hello');
  66. });
  67. </span><button id="test1" class="layui-btn">运行上述例子</button>
  68. <span id="hello2">
  69. //弹出一个页面层
  70. $('#test2').on('click', function(){
  71. layer.open({
  72. type: 1,
  73. area: ['600px', '360px'],
  74. shadeClose: true, //点击遮罩关闭
  75. content: '\<\div style="padding:20px;">自定义内容\<\/div>'
  76. });
  77. });
  78. </span><button id="test2" class="layui-btn">运行上述例子</button>
  79. <span id="hello3">
  80. //弹出一个iframe层
  81. $('#parentIframe').on('click', function(){
  82. layer.open({
  83. type: 2,
  84. title: 'iframe父子操作',
  85. maxmin: true,
  86. shadeClose: true, //点击遮罩关闭层
  87. area : ['800px' , '520px'],
  88. content: 'test/iframe.html'
  89. });
  90. });
  91. </span><button id="parentIframe" class="layui-btn">运行上述例子</button>
  92. <span id="hello4">
  93. //弹出一个loading层
  94. $('#test4').on('click', function(){
  95. var ii = layer.load();
  96. //此处用setTimeout演示ajax的回调
  97. setTimeout(function(){
  98. layer.close(ii);
  99. }, 1000);
  100. });
  101. </span><button id="test4" class="layui-btn">运行上述例子</button>
  102. <span id="hello5">
  103. //弹出一个tips层
  104. $('#test5').on('click', function(){
  105. layer.tips('Hello tips!', '#test5');
  106. });
  107. </span><button id="test5" class="layui-btn">运行上述例子</button>
  108. <code><</code>/script>
  109. 当你对此建立了一定的初始,你应该去详看API手册了。
  110. <code><</code>/body>
  111. <code><</code>/html>
  112. </pre>
  113. </div>
  114. <div class="layui-footer footer footer-index">
  115. <div class="layui-main">
  116. <p>&copy; 2017 <a href="../index.html" tppabs="http://www.layui.com/">「本站仅为 layui 文档保留的镜像站点,与官方无关」</a> MIT license</p>
  117. <p>
  118. <a href="http://fly.layui.com/jie/3147.html" target="_blank">捐赠</a>
  119. <a href="mailto:xianxin@layui.com">联系</a>
  120. <a href="http://fly.layui.com/jie/2461.html" target="_blank">微信公众号</a>
  121. </p>
  122. </div>
  123. </div>
  124. <script>
  125. !function(){
  126. for(var i = 1; i <= 5; i++){
  127. new Function($('#hello'+ i).text())();
  128. }
  129. }();
  130. </script>
  131. </body>
  132. </html>