您的位置:首页 > Web前端 > BootStrap

bootstrap 3.3 模态框垂直居中问题

2016-09-23 17:09 465 查看
/* center modal */
function centerModals(){
$('.modal').each(function(i){
var $clone = $(this).clone().css('display', 'block').appendTo('body');    var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);
top = top > 0 ? top : 0;
$clone.remove();
$(this).find('.modal-content').css("margin-top", top);
});
}
$('.modal').on('show.bs.modal', centerModals);
$(window).on('resize', centerModals);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: