Created
October 12, 2016 17:54
-
-
Save bclinkinbeard/066f94e1469120d91e1b6e0441da58c1 to your computer and use it in GitHub Desktop.
D3 listener collisions across iframes
This file contains hidden or 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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style> | |
circle { | |
fill: green; | |
} | |
</style> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script> | |
</head> | |
<body> | |
<svg width="300px" height="300px"> | |
<circle cx="10" cy="10" r="10"></circle> | |
<circle cx="10" cy="35" r="10"></circle> | |
<circle cx="10" cy="60" r="10"></circle> | |
</svg> | |
<script> | |
d3.selectAll('circle') | |
.on('click', function () { | |
d3.select(this).style('fill', 'red'); | |
}) | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<iframe src="frame.html" frameborder="0"></iframe> | |
<iframe src="frame.html" frameborder="0"></iframe> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment