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

前端 未结 6 508
隐瞒了意图╮
隐瞒了意图╮ 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:06

    To expand on Ryand's answer, if you're using Bootstrap.ui, this on your modal-instance will do the trick:

        modalInstance.rendered.then(function (result) {
            $('.modal .modal-body').css('overflow-y', 'auto'); 
            $('.modal .modal-body').css('max-height', $(window).height() * 0.7);
            $('.modal .modal-body').css('height', $(window).height() * 0.7);
        });
    

提交回复
热议问题