亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

為關閉模態窗口啟用向下滑動動畫

為關閉模態窗口啟用向下滑動動畫

慕工程0101907 2021-09-30 09:33:10
我使用 html、css 和 JavaScript 創建了一個模態,其代碼包含在片段中。你會注意到當一個模態窗口打開時,它有一個從頂部滑動的動畫。我想讓模態窗口在關閉時具有滑動到底部的動畫(而不是在其位置時立即消失)有人可以調整代碼以達到預期的效果嗎?提前致謝!let open_modals = [];(function() {  // Get the button that opens the modal  // read all the control of any type which has class as modal-button  var btn = document.querySelectorAll(".modal-button");  // All page modals  var modals = document.querySelectorAll('.modal');  // Get the <span> element that closes the modal  var spans = document.getElementsByClassName("close");  // When the user clicks the button, open the modal  for (var i = 0; i < btn.length; i++) {    btn[i].onclick = function(e) {      e.preventDefault();      modal = document.querySelector(e.target.getAttribute("href"));      modal.style.display = "block";      open_modals.push(modal.id);    }  }  // When the user clicks on <span> (x), close the modal  for (var i = 0; i < spans.length; i++) {    spans[i].onclick = function() {      for (var index in modals) {        if (typeof modals[index].style !== 'undefined' && modals[index].id == open_modals[open_modals.length - 1]) {          modals[index].style.display = "none";          open_modals.pop();        }      }    }}})();
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 204 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號