第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何顯示非模態(tài)/非模態(tài) HTML/JavaScript 對話

如何顯示非模態(tài)/非模態(tài) HTML/JavaScript 對話

我根據(jù) w3schools 上的示例創(chuàng)建了一個模態(tài)對話。但我一直無法找到有關(guān)如何使其非模態(tài)的指導(dǎo)。即是否可以顯示對話并且我仍然可以在后臺按鏈接?實際上,我想要實現(xiàn)的是允許對話框內(nèi)的鏈接可單擊,并允許其后面主頁上的 JavaScript 對這些事件做出反應(yīng)。<!DOCTYPE html><html>    <head>        <meta charset="UTF-8">        <meta http-equiv="Content-Security-Policy"  content="connect-src * 'unsafe-inline';">        <style>/* The Modal (background) */.modal {  display:block; /* Hidden by default */  position: fixed; /* Stay in place */  z-index: 1; /* Sit on top */  left: 0;  top: 0;  width: 100%; /* Full width */  height: 100%; /* Full height */  overflow-y: auto; /* Enable scroll if needed */  background-color: rgb(0,0,0); /* Fallback color */  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */}/* Modal Content/Box */.modal-content {  background-color: #fefefe;  margin: 15% auto; /* 15% from the top and centered */  padding: 20px;  border: 1px solid #888;  width: 80%; /* Could be more or less, depending on screen size */}/* The Close Button */.close {  color: #aaa;  float: right;  font-size: 28px;  font-weight: bold;}.close:hover,.close:focus {  color: black;  text-decoration: none;  cursor: pointer;}     </style>    </head><body>    <a href='#'>Press me press me I am blocked</a>    <!-- The Modal -->    <div id="myModal" class="modal">        <!-- Modal content -->        <div class="modal-content">        <span class="close" onclick="modalHide()">&times;</span>        <div id="modtext">Some text in the Modal..</div>        </div>    </div>    <script>    function modalHide(){        document.getElementById("myModal").style.display = "none";    }    </script></body></html>
查看完整描述

1 回答

?
躍然一笑

TA貢獻(xiàn)1826條經(jīng)驗 獲得超6個贊

只需刪除(.modal)模態(tài)背景,因為它作為覆蓋層工作。


/* The Modal (background) */

.modal {

  display:block; /* Hidden by default */

  position: fixed; /* Stay in place */

  z-index: 1; /* Sit on top */

  left: 0;

  top: 0;

  width: 100%; /* Full width */

  height: 100%; /* Full height */

  overflow-y: auto; /* Enable scroll if needed */

  background-color: rgb(0,0,0); /* Fallback color */

  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */

}

上面的代碼創(chuàng)建了一個覆蓋層并顯示其中的對話框。如果刪除它,對話框后面的鏈接將起作用。


<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <meta http-equiv="Content-Security-Policy"  content="connect-src * 'unsafe-inline';">

        <style>



/* Modal Content/Box */

.modal-content {

  background-color: #fefefe;

  margin: 15% auto; /* 15% from the top and centered */

  padding: 20px;

  border: 1px solid #888;

  width: 80%; /* Could be more or less, depending on screen size */

}


/* The Close Button */

.close {

  color: #aaa;

  float: right;

  font-size: 28px;

  font-weight: bold;

}


.close:hover,

.close:focus {

  color: black;

  text-decoration: none;

  cursor: pointer;

    </style>

    </head>


<body>

    <a href='#'>Press me press me I am blocked</a>

    <!-- The Modal -->

    <div id="myModal" class="modal">

        <!-- Modal content -->

        <div class="modal-content">

        <span class="close" onclick="modalHide()">&times;</span>

        <div id="modtext">Some text in the Modal..</div>

        </div>

    </div>

    <script>

    function modalHide(){

        document.getElementById("myModal").style.display = "none";

    }

    </script>

</body>


</html>


查看完整回答
反對 回復(fù) 2024-01-11
  • 1 回答
  • 0 關(guān)注
  • 130 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號