/ Published in: jQuery
Lightbox escape key
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// lightbox fadeout on escape $(document).bind('keydown', function(e) {//use keydown instead of keypress because keypress doesn't work in Chrome and Opera if(e.keyCode==27){ $("#lightbox").fadeOut(300); } });