Skip to content

Instantly share code, notes, and snippets.

@hergaiety
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hergaiety/4fb93d4d2e156bf0940f to your computer and use it in GitHub Desktop.
Save hergaiety/4fb93d4d2e156bf0940f to your computer and use it in GitHub Desktop.
Foundation Don't Close on Esc key if Fullscreen anything is fullscreened
// Don't forget to turn off close_on_esc in your foundation initialization
// $(document).foundation({ reveal: { close_on_esc: false } });
$(document).on('keydown.reveal.custom', dom('reveal'), function(event) {
var isFullscreen = (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement);
if (event.keyCode === 27 && !isFullscreen) $(document).foundation('reveal', 'close');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment