公告层,打开页面后直接弹出来怎么修改

win777777 2017-10-06 01:16:10
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link rel="stylesheet" href="layui/css/layui.css" media="all">
</head>
<body>
<div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">
</blockquote><button data-method="notice" class="layui-btn">示范一个公告层</button>
<script src="layui/layui.js"></script>
<script>layui.use('layer',function(){var $ =layui.jquery,layer =layui.layer;var active ={setTop:function(){var that =this;layer.open({type:2
,title:'当你选择该窗体时,即会在最顶端'
,area:['390px','260px']
,shade:0
,maxmin:true
,offset:[Math.random()*($(window).height()-300)
,Math.random()*($(window).width()-390)
]
,content:'http://layer.layui.com/test/settop.html'
,btn:['继续弹出','全部关闭']
,yes:function(){$(that).click();}
,btn2:function(){layer.closeAll();}
,zIndex:layer.zIndex
,success:function(layero){layer.setTop(layero);}
});}
,confirmTrans:function(){layer.msg('大部分参数都是可以公用的<br>合理搭配,展示不一样的风格',{time:20000,btn:['明白了','知道了','哦']
});}
,notice:function(){layer.open({type:1
,title:false
,closeBtn:false
,area:'300px;'
,shade:0.8
,id:'LAY_layuipro'
,btn:['知道了']
,btnAlign:'c'
,moveType:1
,content:'<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">你知道吗?亲!<br>layer ≠ layui<br><br>layer只是作为Layui的一个弹层模块,由于其用户基数较大,所以常常会有人以为layui是layerui<br><br>layer虽然已被 Layui 收编为内置的弹层模块,但仍然会作为一个独立组件全力维护、升级。<br><br>我们此后的征途是星辰大海 ^_^</div>'
,success:function(layero){var btn =layero.find('.layui-layer-btn');}
});}
,offset:function(othis){var type =othis.data('type')
,text =othis.text();layer.open({type:1
,offset:type
,id:'layerDemo'+type
,content:'<div style="padding: 20px 100px;">'+ text +'</div>'
,btn:'关闭全部'
,btnAlign:'c'
,shade:0
,yes:function(){layer.closeAll();}
});}
};$('#layerDemo .layui-btn').on('click',function(){var othis =$(this),method =othis.data('method');active[method] ?active[method].call(this,othis) :'';});});</script>
</body>
</html>




layui公告层,打开页面后直接弹出来,不用去点。弹出来同时有提示音。上面的代码哪些可以删除,就是不需要的代码。

打开页面,弹出公告层,带提示音
...全文
371 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
win777777 2017-10-06
  • 打赏
  • 举报
回复
$('#layerDemo .layui-btn').on('click',function(){。。。。。。。。。。。。 改成 $(window).on('load',function(){。。。。。。。。。。。。 不行啊
程序员鼓励师 2017-10-06
  • 打赏
  • 举报
回复
刚才回不了贴
天际的海浪 2017-10-06
  • 打赏
  • 举报
回复
$('#layerDemo .layui-btn').on('click',function(){。。。。。。。。。。。。 改成 $(window).on('load',function(){。。。。。。。。。。。。 提示音可以用html5的 <audio> 来播放

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧