做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

原生js實現簡單的模態框示例

來源:懂視網 責編:小采 時間:2020-11-27 22:30:45
文檔

原生js實現簡單的模態框示例

原生js實現簡單的模態框示例:html部分: <img src=images/8.jpg alt=> <button class=btn id=showMax>顯示大圖</button> <div id=modalBox class=modalBox> <div class=modalBox-mat
推薦度:
導讀原生js實現簡單的模態框示例:html部分: <img src=images/8.jpg alt=> <button class=btn id=showMax>顯示大圖</button> <div id=modalBox class=modalBox> <div class=modalBox-mat

html部分:

<img src="images/8.jpg" alt="">
 <button class="btn" id="showMax">顯示大圖</button> 
 <div id="modalBox" class="modalBox">
 <div class="modalBox-matter">
 <header class="modalBox-header">
 <span class="mtclose">×</span>
 </header> 
 <div class="modalBox-body">

    <img src="images/8-1.jpg">

  </div>
 </div>
</div>

js部分:

var btn = document.getElementById('showMax'); 
 var mtclose = document.getElementsByClassName('mtclose')[0];
 var modalBox = document.getElementById('modalBox'); 
 btn.addEventListener('click', function(){ 
 modalBox.style.display = "block"; 
 }); 
 mtclose.addEventListener('click', function(){ 
 modalBox.style.display = "none"; 
 });

css部分:

.btn{ 
 width: 100px; 
 height: 35px; 
 border-radius: 5px; 
 font-size: 16px; 
 color: #F97B39;

 position: absolute;
 top: 130px;
 left: 160px;
 opacity: 0.2;
 cursor: pointer; /*鼠標小手*/
} 

.btn:hover, .btn:focus{ /*focus 取得焦點狀態*/
 background-color: #8AA7F9;
 opacity: 0.5;
 color: #FFFFFF;
} 
.modalBox{ 
 display: none; 
 width: 100%; 
 height: 100%; 
 position: fixed; 
 left: 0; 
 top: 0; 
 z-index: 1000; 
 background-color: rgba(0,0,0,0.5);
}

.modalBox-matter{ 
 display: flex;    /*/*彈性布局*/
 flex-flow: column nowrap; 
 justify-content: space-between;     /*兩端對齊*/
 width: 50%; 
 height: 80%;
 margin: 30px auto 100px; 
 border-radius:10px;
 -webkit-animation: zoom 0.6s; 
 animation: zoom 0.6s; 
 resize: both; 
 overflow: auto; 
}

@keyframes zoom{ 
 from {transform: scale(0)} 
 to {transform: scale(1)} 
}

.modalBox-header{

  margin-left: 617px; 
}

.mtclose{
 color: #602E2A; 
 font-size: 3em; 
 font-weight: bold; 
 transition: all 0.3s;
 /*z-index: 1010; */
 } 
 .mtclose:hover, .mtclose:focus{ 
 color: #602E2A; 
 cursor: pointer; 
}

.modalBox-body{ 
 padding: 10px; 
 font-size: 16px; 
}


效果

因為正在進行的一個項目中,需要一個模態框,所以花時間在網上自學的,相對來說比較簡單,可以自行修改內容。。

以上這篇原生js實現簡單的模態框示例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

原生js實現簡單的模態框示例

原生js實現簡單的模態框示例:html部分: <img src=images/8.jpg alt=> <button class=btn id=showMax>顯示大圖</button> <div id=modalBox class=modalBox> <div class=modalBox-mat
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 江华| 沂源县| 通江县| 天津市| 罗城| 离岛区| 固镇县| 金昌市| 浮山县| 射阳县| 浮梁县| 宁南县| 嘉黎县| 清水县| 兴山县| 泸州市| 营山县| 綦江县| 惠东县| 蓬溪县| 荔浦县| 沅陵县| 浠水县| 长泰县| 本溪市| 澎湖县| 元谋县| 宣恩县| 孟州市| 苍南县| 杭锦旗| 化隆| 巴青县| 玉林市| 陵川县| 格尔木市| 乌鲁木齐市| 乌审旗| 商水县| 丰镇市| 南康市|