Last active
August 29, 2015 14:24
-
-
Save evanleck/98769b2f5e6354a8407b to your computer and use it in GitHub Desktop.
Simpler Handler
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
<a href='video_content'>Show Video</a> | |
<a href='about_content'>Show About</a> | |
<div id='video_content'>...</div> | |
<div id='about_content'>...</div> |
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
document.addEventListener('click', function(clickEvent) { | |
// https://developer.mozilla.org/en-US/docs/Web/API/Event/target | |
var target = clickEvent.target; | |
// https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName | |
if (target.nodeName == 'A') { | |
// https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault | |
clickEvent.preventDefault(); | |
document.getElementById(target.href).style.visibility = "visible"; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment