I am making a light box gallery widget, now i need to detect the keypress and call to a function but only when the #lightbox element is visible, and if it is not, it should ignore the key press, using jquery, i tried the following:
$("#lightbox").keyup(function(e) {
alert(e.keyCode);
if (e.keyCode == 27) { alert("a") } // esc
});
any sugestion guys?
or
http://api.jquery.com/visible-selector/