0
//Get the modal
var modal = document.getElementById('myModal');
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div style="padding: 5px;">
<a href="${pageContext.request.contextPath}/">Home</a>
|
<a href="${pageContext.request.contextPath}/ExaNonProd?exaType=NWHX4">NWH X4</a>
|
<a href="${pageContext.request.contextPath}/ExaNonProd?exaType=NWHX6">NWH X6</a>
|
<a href="${pageContext.request.contextPath}/ExaProd?exaType=NDCX4">NDC X4</a>
|
<a href="${pageContext.request.contextPath}/ExaNonProd?exaType=NDCX6">NDC X6</a>
|
<a href="#" data-toggle="modal" data-target="#myModal">ReadMe</a>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">×</span>
<h2>Exadata Capacity Read Me</h2>
</div>
<div class="modal-body">
<p>Some text in the Modal Body</p>
<p>Some other text...</p>
</div>
</div>
</div>
我有這樣的代碼中,我創建了一個自述模式, 如果我點擊外模態它關閉我可以用自述的鏈接只是一個單一的點擊重新打開它,但是 如果我關閉使用「X」我必須點擊兩次自述環節得到它重新打開該模式。
我不出來,是的,我真的很新本,以及...
是的,我開始與無奈我說好的做用的網站和引導CSS其餘CSS做好改變格式的模式之外的所有類型的東西,所以我創建了自己的CSS只是模式,這又要求我添加JavaScript。所以一直在尋找它沒有使用引導CSS – blp
@blp請看看我上面的編輯解決方案 –