首页 > 其他 > 详细

bootstrap 3.3 模态框垂直居中问题

时间:2015-03-04 19:34:55      阅读:1233      评论:0      收藏:0      [点我收藏+]
/* 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);

bootstrap 3.3 模态框垂直居中问题

原文:http://my.oschina.net/daoinfo/blog/382611

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!