Last active
August 29, 2015 13:56
-
-
Save timwco/9212770 to your computer and use it in GitHub Desktop.
Show/Hide Barley Icon - http://getbarley.com
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
// Hide the Barley Icon by default | |
// Show the Barley Icon on ESC Key Press | |
// Make sure DOM is loaded | |
document.addEventListener('DOMContentLoaded', function(){ | |
// The Barley Icon Element | |
var barleybar = document.getElementById('barley-bar'); | |
// Hide By Default | |
barleybar.style.display = 'none'; | |
// Listen for Escape Key Press and Show Icon | |
document.addEventListener('keydown', function (e) { | |
if ( e.keyCode === 27 ) { | |
barleybar.style.display = 'block'; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment