Home  >  Article  >  Web Front-end  >  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
angryTomOriginal
2019-07-19 16:20:095429browse

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); //再执行关闭

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

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

(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层

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!

Statement:
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
Previous article:How to use layui pagingNext article:How to use layui paging