]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix escape key when no reveal is shown 3872/head
authorGabriel JUCHAULT <gabriel_juchault@msn.com>
Thu, 12 Dec 2013 01:05:28 +0000 (02:05 +0100)
committerGabriel JUCHAULT <gabriel_juchault@msn.com>
Thu, 12 Dec 2013 01:05:28 +0000 (02:05 +0100)
If you try to press escape key when no reveal modal is shown; an error is thrown. Fixed.

js/foundation/foundation.reveal.js

index 4f61b896765eef8de73b3ceb3fe22ab1922af2ab..4209209320c941475845a458853f9170df3376ad 100644 (file)
       $('body').on('keyup.fndtn.reveal', function ( event ) {
         var open_modal = $('[data-reveal].open'),
             settings = open_modal.data('reveal-init');
-        if ( event.which === 27  && settings.close_on_esc) { // 27 is the keycode for the Escape key
+        if ( settings && event.which === 27  && settings.close_on_esc) { // 27 is the keycode for the Escape key
           open_modal.foundation('reveal', 'close');
         }
       });