Last active
August 29, 2015 14:18
-
-
Save hergaiety/4fb93d4d2e156bf0940f to your computer and use it in GitHub Desktop.
Foundation Don't Close on Esc key if Fullscreen anything is fullscreened
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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