Bootstrap 3 - set height of modal window according to screen size

前端 未结 6 511
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 03:58

I am trying to create a kind of responsive megamenu using Bootstrap 3 modal dialog. I would like to set the width and height of the whole modal window to 80% of the viewport

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 04:23

    Similar to Bass, I had to also set the overflow-y. That could actually be done in the CSS

    $('#myModal').on('show.bs.modal', function () {
        $('.modal .modal-body').css('overflow-y', 'auto'); 
        $('.modal .modal-body').css('max-height', $(window).height() * 0.7);
    });
    

提交回复
热议问题