Newer
Older
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>test pop up window (overlay) </title>
<style type="text/css">
#container {
width: 700px;
margin: 0 auto;
}
.overlay {
display: none;
}
#overlay1-container {
width: 700px;
height: 90vh;
/* background: rgba(0,0,0,0.4); */
/* background: rgba(135,206,235,0.8); */
background: rgba(65,105,225,0.2);
/* border: 1px skyblue solid; */
position: fixed;
top: 10px;
}
#overlay1-content {
width: 400px;
height: 300px;
/* border: 1px red solid; */
margin: 20px auto;
background: white;
box-shadow: 3px 3px 3px black;
padding: 20px;
}
#close-overlay1 {
position: relative;
left: 100px;
}
#overlay2 {
width: 200px;
height: 150px;
border: 1px red solid;
position: fixed;
top: 10px;
background: white;
}
</style>
</head>
<body>
<div id="container">
<h3>My Page
<a id="show-overlay1" href="#">overlay1</a>
<a id="show-overlay2" href="#">overlay2</a>
</h3>
<p>This is the default page content</p>
<div id="overlay1-container" class="overlay">
<div id="overlay1-content">
<h3>This is overlay title <a id="close-overlay1" href="#">close</a></h3>
<p>This is overlay content</p>
</div>
</div>
<div id="overlay2" class="overlay">
<h3>This is overlay title <a id="close-overlay2" href="#">close</a></h3>
<p>This is overlay content</p>
</div>
</div>
<script type="text/javascript" src="vendor/jquery.min.js"></script>
<script type="text/javascript">
$('#show-overlay1').click(function (evt) {
$('#overlay1-container').show();
return false;
});
$('#show-overlay2').click(function (evt) {
$('#overlay2').show();
return false;
});
$('#close-overlay1').click(function (evt) {
$('#overlay1-container').hide();
return false;
});
$('#close-overlay2').click(function (evt) {
$('#overlay2').hide();
return false;
});
$('#overlay1-container').click(function (evt) {
$('#overlay1-container').hide();
});
$('#overlay1-content').click(function (evt) {
// do nothing.
return false;
});
// page init
$('#overlay1-container').show();
// $('#overlay2').show();
</script>
</body>
</html>