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

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

如何準確識別觸發(fā)事件偵聽器的元素?

如何準確識別觸發(fā)事件偵聽器的元素?

qq_笑_17 2021-05-06 14:23:23
我正在模態(tài)窗口中創(chuàng)建幻燈片放映!首先,我單擊網(wǎng)站上的12張圖像中的一張...然后打開模態(tài)窗口,其中包含帶有幻燈片放映的窗口...應將我單擊的圖片(img)視為背景圖片(作為背景圖片)幻燈片中的第一張圖片。網(wǎng)頁上的圖片位于id為pic_cnt的div中在模態(tài)幻燈片顯示窗口的div(id modal_window)中,有12個div(每個圖片),其類別為modal_pic!具有此類的每個div的背景圖像的順序與網(wǎng)頁上的img順序相同,但不透明度為0。我在頁面上的每個img上添加了一個事件監(jiān)聽器,以打開模式窗口!如何將單擊的img與相同的背景圖像連接起來?單擊img后,應添加模態(tài)窗口中具有相同背景圖像的類(.current),以將不透明度更改為1。請幫助!let modal = document.getElementById('modal');let clickedPic = document.querySelectorAll('#pic_cnt img');let modalPic = document.querySelectorAll('#modal_window div');for (let i = 0; i < clickedPic.length; i++) {  clickedPic[i].addEventListener('click', openModal)}function openModal() {  modal.style.display = "block";}#modal {  display: none;  position: fixed;  top: 0;  left: 0;  width: 100vw;  height: 100vh;  z-index: 2;  background-color: rgba(1, 1, 1, .8);}#modal_window {  background-color: white;  position: absolute;  top: 50%;  left: 50%;  transform: translate(-50%, -50%);  height: 55%;  width: 55%;}.modal_pic {  width: 100%;  height: 100%;  ;  position: absolute;  opacity: 0;}.current {  opacity: 1;}
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 140 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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