How to Close the iframe Window opened by layui

(1) Close the specific iframe

//When closing itself in the iframe page, the following js script is executed in the iframe page

var index = parent.layer.getFrameIndex(window.name); //get the index of the current iframe layer first

parent.layer.close(index); //then execute close

(2) The parent page passes a reference to the iframe pop-up layer

var collectionId = parent.$(“#hideCollectionId”).val();//you can define the hidden field in the parent page, the id is hideCollectionId, you need to refer to jquery

(3) close all pop-up layers

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

layer.closeAll(); //mad mode, close all layers

layer.closeAll(‘dialog’); //close the message box

layer.closeAll(‘page’); //close all page layers

layer.closeAll(‘iframe’); //close all iframe layers

layer.closeAll(‘loading’); //close the loading layer

layer.closeAll(‘tips’); //close all tips layers

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *