Skip to content

Instantly share code, notes, and snippets.

@suxiaogang
Last active April 27, 2020 16:36
Show Gist options
  • Save suxiaogang/cb6576e25a6a638c1814 to your computer and use it in GitHub Desktop.
Save suxiaogang/cb6576e25a6a638c1814 to your computer and use it in GitHub Desktop.
/*Bootstrap modal size*/
@media (max-width: 1280px){
.modal-dialog {
height:630px;
width:800px;
}
.modal-body {
height: 500px;
}
}
@media screen and (min-width:1281px) and (max-width:1600px){
.modal-dialog {
height:700px;
width:1000px;
}
.modal-body {
height: 550px;
}
}
@media screen and (min-width:1601px) and (max-width:1920px){
.modal-dialog {
height:830px;
width:1200px;
}
.modal-body {
height: 700px;
}
}
/*Vertically centering Bootstrap modal window*/
.vertical-alignment-helper {
display:table;
height: 100%;
width: 100%;
pointer-events:none; /* This makes sure that we can still click outside of the modal to close it */
}
.vertical-align-center {
/* To center vertically */
display: table-cell;
vertical-align: middle;
pointer-events:none;
}
.modal-content {
/* Bootstrap sets the size of the modal in the modal-dialog class, we need to inherit it */
width:inherit;
height:inherit;
/* To center horizontally */
margin: 0 auto;
pointer-events: all;
}
/***********************************************/
<div class="modal fade" id="myModalView" style="display:none;">
<div class="vertical-alignment-helper">
<div class="modal-dialog modal-lg vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">信息历史记录</h4>
</div>
<div class="modal-body">
<iframe id="myiframeView" src="" width="100%" height="100%" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.vertical-alignment-helper -->
</div><!-- /.modal -->
function getWaringMessage(entid) {
//window.location.href = "/waring-messageList?entid=" + entid;
$('#myModalView').modal('show');
clearIframeContent("myiframeView");
showProcess();
$('#myiframeView').attr('src', '/waring-messageList-iframe?entid=' + entid);
$('#myiframeView').load(function(){
//your code (will be called once iframe is done loading)
hiddenProcess();
});
}
function clearIframeContent(elementID){
var iframe = document.getElementById(elementID);
var html = "";
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(html);
iframe.contentWindow.document.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment