Created
March 25, 2019 08:22
-
-
Save shaomingquan/a1d383d4e87f332fe2d3f2aeb29222b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> | |
#a { | |
height: 300px; | |
width: 300px; | |
background-color: #eee; | |
} | |
#b { | |
height: 200px; | |
width: 200px; | |
background-color: #ccc; | |
} | |
#c { | |
height: 100px; | |
width: 100px; | |
background-color: #bbb; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="a"> | |
<div id="b"> | |
<div id="c"></div> | |
</div> | |
</div> | |
</body> | |
<script> | |
var a = document.getElementById('a') | |
var b = document.getElementById('b') | |
var c = document.getElementById('c') | |
const useCaptrue = true | |
a.addEventListener('click', function (e) { | |
console.log('a', e.path.length) | |
}, useCaptrue) | |
b.addEventListener('click', function (e) { | |
console.log('b', e.path.length) | |
}, useCaptrue) | |
c.addEventListener('click', function (e) { | |
console.log('c', e.path.length) | |
}, useCaptrue) | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment