如何使主网页滚动模式(How to make modal scroll with main page

2019-09-16 10:21发布

我有内容不是浏览器的高度更高,因此我有一些内容无法显示一个模式。 (好像模态位置是固定的,并且不能被滚动作为一个整体)

我怎样才能让滚动模式与主网页,这样我可以实际查看下面的内容?

Answer 1:

你可以做的是设置模式的CSS position绝对不是固定的。

要做到这一点,刚刚拿到模式或ID这样的类名,并把它设置为absolute

.modal {
position: absolute !important;
}

或者,甚至更好,编辑主CSS为您模式(如果你能),改变position ,从fixedabsolute

的jsfiddle例如: http://jsfiddle.net/hUNZs/



Answer 2:

我已经试过<div class="modal myModal"></div>

CSS

.myModal {
      overflow: auto !important; 
      height: 300px; //set a height to a modal so it wont overlapped when the body tag's height is smaller than the modal
}


文章来源: How to make modal scroll with main page