layer iframe 設置關閉按鈕 和刷新


layer.open({
type: 2,
title: 'XXXX網吧歷史更多數據',
shade:0,
// closeBtn:0,
resize:false,
move:false,
shadeClose: true, //點擊遮罩關閉層
area : ['800px' , '600px'],
content: '營業數據詳情 更多數據.html'
,btn: [ '關閉']
,success: function(layero){
layero.find('.layui-layer-btn').css('text-align','center');
}

});

直接在layer.open中設置btn:['關閉],就有了關閉按鈕,點擊即關閉iframe頁面

在success: function(layero){ layero.find('.layui-layer-btn').css('text-align','center');

調整按鈕居於中間底部

一:使用layer.open打開的子頁面

window.parent.location.reload()//刷新父頁面

var index = parent.layer.getFrameIndex(window.name)//獲取窗口索引

parent.layer.close(index)  

1:刷新父頁面

2:關閉此頁面

    2.1  獲取窗口索引 (parent.window.name  或者window.name)

    2.2 父級執行關閉

  二:使用top.layer.open打開子頁面

$(window.parent.document).find("iframe")[0].contentWindow.location.reload(true);

1:先獲取頁面中iframe

2:獲取需要刷新的iframe

3:刷新contentWindow.location.reload(true);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM