-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpopup.html
147 lines (141 loc) · 3.35 KB
/
webpopup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
background-image: url("https://www.pixelstalk.net/wp-content/uploads/2016/08/HD-Best-Nature-Wallpapers-For-Desktop.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position:center;
}
.container{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
color: #ffff;
}
.container h1{
font-size: 40px;
}
.container button{
margin: 10px;
font-size: 18px;
padding: 12px 14px;
border: none;
outline: none;
border-radius: 5px;
background-color: #35910b;
color: #ffff;
cursor: pointer;
}
#popup{
width:450px;
height: 250px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
border: 2px solid blue;
background-color: #2C3335;
color: #fff;
display: none;
flex-direction: column;
/* animation: pop 0.5s ease-in, fade 0.5s ease-in forwards; */
transition: all 0.7s;
opacity: 1;
}
@keyframes pop{
from{
top: 48%;
opacity: 0;
}
to{
top: 50%;
opacity: 1;
}
}
@keyframes fade {
from{
opacity: 1;
}
to{
top: -48%;
opacity: 0;
}
}
#popup h4{
text-align: center;
margin: 17px;
font-size: 30px;
}
#popup label{
display: block;
text-align: center;
font-size: 21px;
font-weight: 600;
letter-spacing: 1px;
}
#popup input{
width: 90%;
margin: 18px;
margin-bottom: 3px;
padding: 10px;
border: none;
outline: none;
border-radius: 0;
font-size: 19px;
align-self: center;
}
#popup button{
margin: 5px 10px 10px 10px;
font-size: 18px;
padding: 12px 14px;
border: none;
outline: none;
border-radius: 5px;
background-color: #35910b;
color: #ffff;
align-self: center;
width: 90%;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to webpage</h1>
<button id="btn">Click to join</button>
</div>
<div id="popup">
<h4>20% OFF offer</h4>
<label for="email">Email</label>
<input type="email" name="email" id="inp">
<button id="submit">Join</button>
</div>
<script>
const popup = document.getElementById("popup");
const btn = document.getElementById("btn");
const submit = document.getElementById("submit");
const inp = document.getElementById("inp");
btn.addEventListener("click", ()=>{
popup.style.display = 'flex';
// popup.style.animation = 'pop 0.5s ease-in';
});
submit.addEventListener("click",() =>{
popup.style.display = 'none';
// popup.style.animation = 'fade 0.5s ease-in forwards';
});
</script>
</body>
</html>