自己写modal的背景
html:
<div class='modal-background'></div>
css:
.modal-background {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #333;
opacity: 0.9;
z-index: 999;
}
要点:这里的div一定要固定定位,因为固定定位是相对于浏览器窗口的,还要写上z-index的值。