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!

The article discusses using Layui's flow module for infinite scrolling, covering setup, best practices, performance optimization, and customization for enhanced user experience.

The article details how to use Layui's element module to create and customize UI elements like tabs, accordions, and progress bars, highlighting HTML structures, initialization, and common pitfalls to avoid.Character count: 159

The article discusses customizing Layui's carousel module, focusing on CSS and JavaScript modifications for appearance and behavior, including transition effects, autoplay settings, and adding custom navigation controls.

The article guides on using Layui's carousel module for image sliders, detailing steps for setup, customization options, implementing autoplay and navigation, and performance optimization strategies.

The article discusses configuring Layui's upload module to restrict file types and sizes using accept, exts, and size properties, and customizing error messages for violations.

The article explains how to use Layui's layer module to create modal windows and dialog boxes, detailing setup, types, customization, and common pitfalls to avoid.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software