css 简单的香草莫代尔

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 简单的香草莫代尔相关的知识,希望对你有一定的参考价值。

<div class="modal-outer">
  <div class="modal-box">
    <div class="modal-content">
      <!-- CONTENT HERE -->
    </div>
  </div>
  <button class="exit-modal">X</button>
</div>
var connectButton = document.querySelector('.connect-button')
var modalOuter = document.querySelector('.modal-outer')
var modalBox = document.querySelector('.modal-box')
var exitModal = document.querySelector('.exit-modal')

function openModal () {
  modalOuter.classList.add('active')
  window.setTimeout(openModalBox, 200)
}

function openModalBox () {
  modalBox.classList.add('active')
}

function closeModal () {
  modalOuter.classList.remove('active')
  window.setTimeout(closeModalBox, 200)
}

function closeModalBox () {
  modalBox.classList.remove('active')
}

connectButton.addEventListener('click', openModal)
exitModal.addEventListener('click', closeModal)
window.addEventListener('keydown', function (e) {
  console.log(e.keyCode)
  if (e.keyCode === 27) {
    console.log('hello')
    closeModal()
  }
})
.modal-outer {
	z-index: -1;
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(255,255,255,1);
	padding: 20px;
	opacity: 0;
	transition: opacity 0.2s;
	display: flex;
	justify-content: center;
	flex-direction: column;
}
.modal-outer.active {
	opacity: 1;
	z-index: 1;
}
.modal-box {
	height: 0;
	border: 2px solid rgba(0,0,0,0.2);
	width: 800px;
	margin: 0 auto;
	transition: height 0.8s;
	overflow: hidden;
}
.modal-content {
	box-sizing: border-box;
	padding: 40px;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	text-align: center;
	opacity: 0;
	transition: opacity 0.8s;
	transition-delay: 0.4s;
	color: #6c7273;
}
.modal-box.active {
	height: 400px;
}
.modal-box.active .modal-content {
	opacity: 1;
}
.exit-modal {
	position: fixed;
	top: 20px;
	left: 20px;
	display: inline-block;
	padding: 10px;
	font-size: 2em;
	font-weight: 100;
	height: auto;
	border: 0;
	color: rgba(0,0,0,0.6)
}
.modal-content .contact-list li {
	display: block;
}

@media (max-width: 840px) {
	.modal-box {
		width: 100%;
	}
}

以上是关于css 简单的香草莫代尔的主要内容,如果未能解决你的问题,请参考以下文章

html 莫代尔-NIA-HWU

html 莫代尔,temp.html

php 莫代尔amb lightbox crida页面

在反应天然莫代尔底部菜单

sql 后链接apex y abrir莫代尔

清除URL主题标签的最佳方法