Boostrap 模态框 水平垂直居中问题
var editorB = new UE.ui.Editor({ initialFrameHeight: 350, initialFrameWidth: 600 });
editorA.render("ScienceContentA");
editorB.render("ScienceContentB");
$(function () {
//$("#AddUpdateModalA").modal("hide").css({
// //top: 0,
// left:0,
// "margin-top": function () {
// //return -$(window).height()/2 + ($(window).height() - $(this).height()) / 2;
// return - ($(this).height() / 2)-70;
// },
// "margin-left": function () {
// return ($(window).width() - $(this).width())/2;
// }
//});
$('.modal').on('show.bs.modal', centerModals);
$(window).on('resize', centerModals);
//PageQuery();//分页查询数据
});
//模态框水平垂直居中函数
function centerModals() {
$('.modal').each(function (i) {
var top = -($(this).height() / 2) - 70;
var left = ( $ (window).width() - $(this).width()) / 2;
$(this).css("margin-top", top);
$(this).css("margin-left", left);
});
}
who:whaozl
QQ:1057674944
email:whaozl@163.com
blog:http://www.cnblogs.com/whaozl
note:原创博客请尊重版权,转载必须得到本人同意