Created
August 18, 2017 20:49
-
-
Save anacampesan/3270023f25e54a6e491b071daec98377 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
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
var notificationBtn = document.getElementById('notificationBtn'); | |
var notificationBox = document.getElementById('notificationBox'); | |
document.body.addEventListener('click', function(ev) { | |
notificationBox.style.display = 'none'; | |
}); | |
notificationBtn.addEventListener('click', function(ev) { | |
ev.stopPropagation(); | |
notificationBox.style.display = notificationBox.style.display == 'none' ? 'block' : 'none'; | |
}); | |
}); | |
</script> | |
<button id="notificationBtn">Menu</button> | |
<div id="notificationBox" style="display: none;"> | |
<ul> | |
<li>...</li> | |
<li>...</li> | |
<li>...</li> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment