JS 免费按钮与 "popup"/overlay 链接
JS free Button linked with a "popup"/overlay
我尝试用 javascript button
打开 'popup'/叠加层。不幸的是我的按钮没有打开它。
我哪里出错了?有更好的方法吗?
它应该是 javascript
免费的。
……………………………………………………………………………………………………
/* popup */
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 80%;
height: 80%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 2%;
right: 4%;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
<button href="#popup4">btn1</button>
<div id="popup4" class="overlay">
<div class="popup"><h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
</div>
您的按钮本身没有任何作用,它必须通过表单提交。
<form method="get" action="#popup4">
<button>btn1</button>
</form>
我尝试用 javascript button
打开 'popup'/叠加层。不幸的是我的按钮没有打开它。
我哪里出错了?有更好的方法吗?
它应该是 javascript
免费的。
……………………………………………………………………………………………………
/* popup */
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 80%;
height: 80%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 2%;
right: 4%;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
<button href="#popup4">btn1</button>
<div id="popup4" class="overlay">
<div class="popup"><h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
</div>
您的按钮本身没有任何作用,它必须通过表单提交。
<form method="get" action="#popup4">
<button>btn1</button>
</form>