demo.js-t=202136.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* layim demo */
  2. layui.use(['layer', 'util', 'element'], function(){
  3. var $ = layui.jquery;
  4. var layer = layui.layer;
  5. var util = layui.util;
  6. var element = layui.element;
  7. var device = layui.device();
  8. //固定Bar
  9. util.fixbar({
  10. });
  11. layer.ready(function(){
  12. var local = layui.data('layui');
  13. return;
  14. layer.open({
  15. type: 1
  16. ,title: '重要公告' //不显示标题栏
  17. ,closeBtn: false
  18. ,area: '300px;'
  19. ,shade: false
  20. ,offset: 'b'
  21. ,id: 'LAY_layimNotice' //设定一个id,防止重复弹出
  22. ,btn: ['朕知道了']
  23. ,btnAlign: 'c'
  24. ,moveType: 1 //拖拽模式,0或者1
  25. ,content: ['<div class="layui-text">'
  26. ,'<a href="http://fly.layui.com/jie/3147/" target="_blank" style="color: #fff;"></a>'
  27. ,'</div>'].join('')
  28. ,skin: 'layui-layer-notice'
  29. ,success: function(layero){
  30. return;
  31. var btn = layero.find('.layui-layer-btn');
  32. btn.find('.layui-layer-btn0').attr({
  33. href: 'http://fly.layui.com/jie/15827/' //'http://fly.layui.com/jie/15695/'
  34. ,target: '_blank'
  35. });
  36. }
  37. ,end: function(){
  38. return;
  39. layui.data('layui', {
  40. key: 'notice_ddos'
  41. ,value: new Date().getTime()
  42. });
  43. }
  44. });
  45. });
  46. var active = {
  47. mobile: function(){
  48. var mobileHome = 'https://www.layui.com/layim/demo/mobile.html';
  49. if(device.android || device.ios){
  50. return location.href = mobileHome;
  51. }
  52. var index = layer.open({
  53. type: 2
  54. ,title: '移动版演示 (或手机扫右侧二维码预览)'
  55. ,content: mobileHome
  56. ,area: ['375px', '667px']
  57. ,shadeClose: true
  58. ,shade: 0.8
  59. ,end: function(){
  60. layer.close(index + 2);
  61. }
  62. });
  63. layer.photos({
  64. photos: {
  65. "data": [{
  66. "src": "../../res.layui.com/upload/2016_12/168_1488985841996_23077.png"/*tpa=https://cdn.layui.com/upload/2016_12/168_1481056358469_50288.png*/,
  67. }]
  68. }
  69. ,anim: 0
  70. ,shade: false
  71. ,success: function(layero){
  72. layero.css('margin-left', '350px');
  73. }
  74. });
  75. }
  76. };
  77. //点击获取授权
  78. $('body').on('click', '.layim-active', function(){
  79. var othis = $(this), type = othis.data('type');
  80. active[type] ? active[type].call(this, othis) : '';
  81. });
  82. });