-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.html
97 lines (91 loc) · 2.67 KB
/
popup.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
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://m1.lefile.cn/jquery/jquery-3.5.0.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Two - Layer Popup Stack</title>
<style>
body {
margin: 0;
display: flex;
justify-content: center;
align-items: flex-end;
height: 100vh;
overflow: hidden;
background-color: #f4f4f4;
}
.btn {
position: absolute;
top: 10px;
left: 0;;
}
.popup-container {
position: relative;
width: 100%;
}
.popup {
position: absolute;
bottom: 0;
width: 100%;
background-color: white;
border: 1px solid #ccc;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
padding: 0 20px;
}
.popup1 {
z-index: 1;
height: 400px;
background-color: rgb(191, 225, 232);
transition: transform 0.3s ease;
}
.popup2 {
z-index: 2;
height: 0;
transform: translateY(20px);
height: 400px;
transform: translateY(400px);
background-color: rgb(229, 158, 153);
transition: transform 0.2s ease;
}
.popup2.active {
transform: translateY(30px);
}
.houyangcss {
transform: perspective(1000px) rotateX(10deg);
}
</style>
</head>
<body>
<button class="btn" onclick="togglePopups()">Toggle Popups</button>
<div class="popup-container">
<div class="popup popup1">
<h2>Popup 1</h2>
<p>This is the content of Popup 1.</p>
</div>
<div class="popup popup2">
<h2>Popup 2</h2>
<p>This is the content of Popup 2.</p>
</div>
</div>
<script>
function togglePopups() {
const popup1 = document.querySelector('.popup1');
const popup2 = document.querySelector('.popup2');
popup2.classList.toggle('active');
if($('.popup1').hasClass('houyangcss')) {
$('.popup1').removeClass('houyangcss');
} else {
$('.popup1').addClass('houyangcss');
}
// if (popup2.style.transform === 'translateY(0px)') {
// popup2.style.transform = 'translateY(20px)';
// } else {
// popup2.style.transform = 'translateY(0px)';
// }
}
</script>
</body>
</html>