forked from WangJia-mm/JavaScript201708
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4-bubble.html
More file actions
54 lines (49 loc) · 1.05 KB
/
4-bubble.html
File metadata and controls
54 lines (49 loc) · 1.05 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>珠峰培训</title>
<link rel="stylesheet" href="css/reset.min.css">
<style>
html, body {
width: 100%;
height: 100%;
background: lightblue;
overflow: hidden;
}
#outer {
position: relative;
margin: 20px auto;
width: 300px;
height: 300px;
background: lightgreen;
}
#inner {
position: absolute;
top: 50%;
left: 50%;
margin: -50px 0 0 -50px;
width: 100px;
height: 100px;
background: lightcoral;
}
</style>
</head>
<body>
<div id="outer">
<div id="inner"></div>
</div>
<script>
inner.onclick = function () {
console.log('INNER');
};
outer.onclick = function () {
console.log('OUTER');
};
document.body.onclick = function (e) {
console.log('BODY');
e.stopPropagation()
};
</script>
</body>
</html>