How to bind common event listeners in layui

王林
Release: 2020-11-26 15:37:34
forward
2699 people have browsed it

How to bind common event listeners in layui

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>
Copy after login

js code

$(function () {
    layui.use(&#39;layer&#39;, function(){
        var $ = layui.jquery
            ,layer = layui.layer //弹层
 
        //弹出登录页面
        $(document).on(&#39;click&#39;,&#39;#zq_login&#39;,function(){
            alert("这里写自己的功能...");
            /*layer.open({ //layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
                type: 2,
                title:"登录页面",
                area: [&#39;55%&#39;,&#39;85%&#39;],//类型:String/Array,默认:&#39;auto&#39;  只有在宽高都定义的时候才不会自适应
                fix: false, //不固定
                maxmin: true,//开启最大化最小化按钮
                shadeClose: true,//点击阴影处可关闭
                shade:0.4,//背景灰度
                skin: &#39;layui-layer-rim&#39;, //加上边框
                content: &#39;/zq_blog/html/login_page/index.html&#39;,
                // resize:false
            });*/
        });
 
    });
 
});
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template