demo.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>layer-更懂你的web弹窗解决方案</title>
  6. <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
  7. <script src="layer.js"></script>
  8. <style>
  9. html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'}
  10. a,a:hover{ text-decoration:none;}
  11. pre{font-family:'微软雅黑'}
  12. .box{padding:20px; background-color:#fff; margin:50px 100px; border-radius:5px;}
  13. .box a{padding-right:15px;}
  14. #about_hide{display:none}
  15. .layer_text{background-color:#fff; padding:20px;}
  16. .layer_text p{margin-bottom: 10px; text-indent: 2em; line-height: 23px;}
  17. .button{display:inline-block; *display:inline; *zoom:1; line-height:30px; padding:0 20px; background-color:#56B4DC; color:#fff; font-size:14px; border-radius:3px; cursor:pointer; font-weight:normal;}
  18. .photos-demo img{width:200px;}
  19. </style>
  20. </head>
  21. <body>
  22. <div class="box">
  23. <pre>
  24. @Name:layer-v<script>document.write(layer.v)</script> 弹层组件说明
  25. @Author:贤心
  26. @Blog:<a href="http://sentsin.com" target="_blank">http://sentsin.com</a>
  27. @Site:<a href="http://layer.layui.com/?form=local" target="_blank">http://layer.layui.com</a>
  28. @Github:<a href="https://github.com/sentsin/layer" target="_blank">https://github.com/sentsin/layer</a>
  29. <strong>【注意事项】</strong>
  30. 一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。
  31. 二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页)
  32. 三、jquery需1.8+
  33. 四、更多使用说明与演示,请参见layer官网。
  34. 五、使用时请务必保留来源,请勿用于违反我国法律的web平台。
  35. 六、layer遵循LGPL协议,将永久性提供无偿服务。版权最终解释权:贤心。
  36. </pre>
  37. </div>
  38. <div class="box">
  39. <h2 style="padding-bottom:20px;">扩展模块:图片查看器(相册层)</h2>
  40. <div id="photosDemo" class="photos-demo">
  41. <!-- layer-src表示大图 layer-pid表示图片id src表示缩略图-->
  42. <img layer-src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" layer-pid="" src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" alt="layer宣传图">
  43. <img layer-src="http://sentsin.qiniudn.com/sentsinmy5.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinmy5.jpg" alt="我入互联网这五年">
  44. <img layer-src="" layer-pid="" src="http://sentsin.qiniudn.com/sentsin_39101a660cf4671b7ec297a74cc652c74152104f.jpg" alt="微摄影">
  45. <img layer-src="http://sentsin.qiniudn.com/sentsinsan01.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinsan01.jpg" alt="三清山">
  46. <img layer-src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" layer-pid="" src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" alt="国足">
  47. </div>
  48. </div>
  49. <div class="box" style="text-align:center">
  50. <a href="http://layer.layui.com/?form=local" target="_blank">更多示例</a>
  51. <a href="http://layer.layui.com/api.html" target="_blank">使用文档</a>
  52. <a href="http://fly.layui.com" target="_blank" title="Fly">交流反馈</a>
  53. <a href="javascript:;" id="about">关于</a>
  54. </div>
  55. <script>
  56. ;!function(){
  57. //加载扩展模块
  58. layer.config({
  59. extend: 'extend/layer.ext.js'
  60. });
  61. //页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕
  62. layer.ready(function(){
  63. //官网欢迎页
  64. layer.open({
  65. type: 2,
  66. //skin: 'layui-layer-lan',
  67. title: 'layer弹层组件',
  68. fix: false,
  69. shadeClose: true,
  70. maxmin: true,
  71. area: ['1000px', '500px'],
  72. content: 'http://layer.layui.com/?form=local',
  73. end: function(){
  74. layer.tips('试试相册模块?', '#photosDemo', {tips: 1})
  75. }
  76. });
  77. //layer.msg('欢迎使用layer');
  78. //使用相册
  79. layer.photos({
  80. photos: '#photosDemo'
  81. });
  82. });
  83. //关于
  84. $('#about').on('click', function(){
  85. layer.alert(layer.v + ' - 贤心出品 sentsin.com');
  86. });
  87. }();
  88. </script>
  89. </body>
  90. </html>