Skip to content

Instantly share code, notes, and snippets.

@timwco
Last active August 29, 2015 13:56
Show Gist options
  • Save timwco/9212770 to your computer and use it in GitHub Desktop.
Save timwco/9212770 to your computer and use it in GitHub Desktop.
Show/Hide Barley Icon - http://getbarley.com
// 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