Posted By

mortu on 08/09/11


escape key keypress

Versions (?)

Lightbox escape key

 / Published in: jQuery

Lightbox escape key

  1. // lightbox fadeout on escape
  2. $(document).bind('keydown', function(e) {//use keydown instead of keypress because keypress doesn't work in Chrome and Opera
  3. if(e.keyCode==27){
  4. $("#lightbox").fadeOut(300);
  5. }
  6. });

Report this snippet  

You need to login to post a comment.