bootstrap 3.3 模态框垂直居中问题 - 番薯丸子

bootstrap 3.3 模态框垂直居中问题




/* 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);

posted on 2018-12-04 18:54 番薯丸子 阅读(204) 评论(0) 编辑收藏举报