search
HomeWeb Front-endLayui TutorialLayui method to close the current pop-up box

Layui method to close the current pop-up box

Mar 03, 2021 am 11:05 AM
layuiPop-up box

Layui method to close the current pop-up box

This article shares two situations and methods for closing the current pop-up box in layui. I hope it can help everyone.

layer.close(index) - Close a specific layer

//当你想关闭当前页的某个层时

var index = layer.open();
var index = layer.alert();
var index = layer.load();
var index = layer.tips();

//正如你看到的,每一种弹层调用方式,都会返回一个index
layer.close(index); //此时你只需要把获得的index,轻轻地赋予layer.close即可

//如果你想关闭最新弹出的层,直接获取layer.index即可
layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的

//当你在iframe页面关闭自身时
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭

layer.closeAll(type) - Close all layers

The closeAll() method will destroy all the current page layer layer, or closeAll(type) only closes a certain type of layer

layer.closeAll();   //关闭所有层

layer.closeAll('dialog');   //关闭信息框

layer.closeAll('page');   //关闭所有页面层

layer.closeAll('iframe');   //关闭所有的iframe层

layer.closeAll('loading');   //关闭加载层

layer.closeAll('tips');   //关闭所有的tips层

Related recommendations: layui tutorial

The above is the detailed content of Layui method to close the current pop-up box. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:博客园. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.