Solve Layui-Open issues to close your own window

解决layui-open关闭自身窗口的问题 1, the pop-up ball here is a page, and it is bombed after the background. One page

1. Implementation

1.1.1, JS part

Function GetArticlebyid (ArticleID) {var index = layer.open ({Type: 2, Title: ‘Modify administrator’, Area: [‘90% ‘, ‘95%’], Shade: 0.8, Resize: False, Fixed: False, Move: False Shadeclose: false, content: ‘$ {ctxpath} / article / getArticleid? ArticleId =’ + articleid});}
   
1.1.2, background java part

/ *** Go to Modify Article page * * / @RequestMapping (“/ getArticlebyid”) Public String getArticlebyid (@RequestParam (“ArticleID”) Integer ArticleID, Model Model {MrtArticle MrtArticle = mrtArticleId (ArticleID); Model.Addattribute (“MrtArticle”, MrtArticle; return “Article / ArticleUpd”;}

  1.2, closes the pop-up window, and the JS section of ArticleUpdate.jsp uses two If it passes yourself  
// When you turn it off at the iframe page, VAR index = parent.Layer.GetFrameIndex (Window.Name); // Get the index of the current IFRAME layer Parent.Layer.close (INDEX); // Perform close Layer.alert (‘Submit Success’, {SKIN: ‘Layui-Layer-Molv’ // Style Class name custom style, ClosebTN: 1 // Whether the shutdown button is displayed, anim: 1 // animation type, btn: [‘OK’] // button, ICON: 6 // icon, yes: function () {// When you turn itself at the iframe page VAR index = parent.Layer.getFrameIndex (Window.Name); // get the index of the current IFRAME layer Parent.Layer.close (INDEX); // Re-execute off}});

Layer.close (Index) – Turn off a specific layer

About it seems to have no need to introduce it, the only thing that makes you doubtful, maybe this is this. In fact it is very easy Get.
 // When you want to close a layer of the current page VAR index = layer.Open (); var index = layer.alert (); var index = layer.loAD (); var index = layer.tips (); // As you can see, each of the laying mode will return indexlayer.close (INDEX); // You only need to get the INDEX , Gently give layer.close // If you want to close the latest pop-up layer, get layer.closex directly to Layer.Closex; // It is always the latest pop-up The value is dynamically incremented by Layer's internal dynamic incremental calculation when you turn it off at the iframe page. Var index = parent.Layer.GetFrameIndex (window.name); ); // Rehaptively turn off Layer.Closeall (Type) - Turn off all layers   
If you are too lazy, you don’t want to get index you just want to close. Then Closeall can really help you. If you don’t point to the layer type, it will destroy all the Layer layers of the current page. Of course, if you just want to close a type of layer, you can

Layer.closeall (); // Crazy mode, close all layers Layer.Closeall (‘ Dialog ‘); // Close the information box Layer.Closeall (‘ Page ‘); // Turn off all page layers layer.closeall (‘ iframe ‘); // Turn off all iframe layers layer.closeall (‘ load “; / / Turn off the loading layer Layer.Closeall (‘tips’); // Close all TIPS layers
   
The problem with which Layui-Open closes its own window is Xiaobian Share all the contents of everyone, hopeI can give you a reference, I also hope that everyone will support Tumi Clouds.
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment