Today for my University project, I was improving the overlay on my current site. I decided I wanted to add a slight extra bit of code so the user can close it by pressing the escape key. Below is the javascript code to use:

$(document).keyup(function(e) {

if (e.keyCode == 27) {
// Close your overlays/divs here //

}
});