Home > Web Front-end > Layui Tutorial > How to close the iframe window of the layer opened by layui

How to close the iframe window of the layer opened by layui

angryTom
Release: 2019-07-19 16:20:09
Original
5675 people have browsed it

How to close the iframe window of the layer opened by layui

(1) Close specific iframe

//当在iframe页面关闭自身时,在iframe页执行以下js脚本
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭
Copy after login

(2) Pass parameters from parent page Go to the iframe pop-up layer

var collectionId = parent.$("#hideCollectionId").val();//可在父页面定义隐藏域,id为hideCollectionId,需要引用jquery
Copy after login

(3) Close all pop-up layers

If there is no complex logic such as pop-up layer overlay , you can close all pop-up layers as needed

layer.closeAll(); //疯狂模式,关闭所有层
layer.closeAll('dialog'); //关闭信息框
layer.closeAll('page'); //关闭所有页面层
layer.closeAll('iframe'); //关闭所有的iframe层
layer.closeAll('loading'); //关闭加载层
layer.closeAll('tips'); //关闭所有的tips层
Copy after login

Recommended tutorial: layui tutorial

The above is the detailed content of How to close the iframe window of the layer opened by layui. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Issues
How about layui framework?
From 1970-01-01 08:00:00
0
0
0
layui cannot be loaded
From 1970-01-01 08:00:00
0
0
0
Why is the reference to layui file invalid?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template