使用 Materialise 卡与模态视图冲突
Using Materialize Cards Conflict with Modal View
我正在尝试使用 Materialise Cards 及其旁边的单独按钮来显示模态视图。一切似乎都正常,但是当我点击模态时,模态内容没有显示在 CSS 中的规定值中,例如模态视图的高度和模态视图时相关的变暗背景阴影已激活(它在页面中途停止)。当我禁用 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
时,它可以工作,但随后 Materialize 内容失败。有没有办法让 Materialize 内容和模态视图高度以及变暗的背景阴影都能正常工作?
HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<span style="display:flex; justify-content:flex-end; width:100%; padding:0;">
<button id="myBtn">Open Modal</button>
</span>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<form id="msform">
<fieldset>
<h2 class="fs-title">Create Discount</h2>
<h3 class="fs-subtitle">Step 1</h3>
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
</form>
</div>
</div>
CSS:
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 1000%; /* Full height */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
/* background-color: #fefefe; */
background: linear-gradient(-45deg, #89f7fe 0%, #66a6ff 60%, #23A6D5, #23D5AB);
margin:auto;
padding: 20px;
border: 1px solid #888;
width: 500px;
height: 500px
}
我能算出来 out-I 只需要在 .modal 中将高度设为 "max-height";只有身高导致了问题,但只有 "height" 在输入 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
之前工作
我正在尝试使用 Materialise Cards 及其旁边的单独按钮来显示模态视图。一切似乎都正常,但是当我点击模态时,模态内容没有显示在 CSS 中的规定值中,例如模态视图的高度和模态视图时相关的变暗背景阴影已激活(它在页面中途停止)。当我禁用 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
时,它可以工作,但随后 Materialize 内容失败。有没有办法让 Materialize 内容和模态视图高度以及变暗的背景阴影都能正常工作?
HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<span style="display:flex; justify-content:flex-end; width:100%; padding:0;">
<button id="myBtn">Open Modal</button>
</span>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<form id="msform">
<fieldset>
<h2 class="fs-title">Create Discount</h2>
<h3 class="fs-subtitle">Step 1</h3>
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
</form>
</div>
</div>
CSS:
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 1000%; /* Full height */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
/* background-color: #fefefe; */
background: linear-gradient(-45deg, #89f7fe 0%, #66a6ff 60%, #23A6D5, #23D5AB);
margin:auto;
padding: 20px;
border: 1px solid #888;
width: 500px;
height: 500px
}
我能算出来 out-I 只需要在 .modal 中将高度设为 "max-height";只有身高导致了问题,但只有 "height" 在输入 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">