The odd question would be like that, but here. I have a page on which I display a photo in large format, for example, in a lightbox. When you press ESC, I close the page and return the user to the page where he came from, which shows the photos in normal format:
$(document).keyup(function(e) { if (e.keyCode == 27) { var closeURL = $('.close').attr('href'); window.location = closeURL; } });
However, the same lightbox page also has a sidebar that can contain embedded Youtube videos. Users can zoom this video to full screen using standard Youtube video player controls. If the user presses ESC in this scenario, he closes the full-screen video and returns to the lightbox page (the standard behavior of the built-in player that I want), however, the ESC key event, and then also my activation code, which closes the lightbox, is undesirable in this particular scenario.
I found that it flocks to be there in Chrome, but not in Firefox. Essentially, I want my ESC code not to run when you press ESC to close the Youtube player, but so that it only works when users press ESC when they watch a photo (not a video).
I searched event.target to distinguish between these scripts, but so far no luck. Any ideas?
Update: I am going to accept this error only for Chrome. However, they are open to solutions.
Ferdy source share