How to bind ordinary events:
Add id or class attributes to the html page where you want to bind. I will use id as an example below
<a class="iconfont icon-touxiang layui-hide-xs" id="zq_login"></a>
js code
$(function () { layui.use('layer', function(){ var $ = layui.jquery ,layer = layui.layer //弹层 //弹出登录页面 $(document).on('click','#zq_login',function(){ alert("这里写自己的功能..."); /*layer.open({ //layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) type: 2, title:"登录页面", area: ['55%','85%'],//类型:String/Array,默认:'auto' 只有在宽高都定义的时候才不会自适应 fix: false, //不固定 maxmin: true,//开启最大化最小化按钮 shadeClose: true,//点击阴影处可关闭 shade:0.4,//背景灰度 skin: 'layui-layer-rim', //加上边框 content: '/zq_blog/html/login_page/index.html', // resize:false });*/ }); }); });
Related recommendations: layui
The above is the detailed content of How to bind common event listeners in layui. For more information, please follow other related articles on the PHP Chinese website!