From: btsai Date: Wed, 15 Jan 2014 07:57:30 +0000 (+0900) Subject: turning on key up capture only when a reveal window is open X-Git-Tag: 5.0.3~1^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F4151%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git turning on key up capture only when a reveal window is open --- diff --git a/js/foundation/foundation.reveal.js b/js/foundation/foundation.reveal.js index 21e83556a..8aaa184ba 100644 --- a/js/foundation/foundation.reveal.js +++ b/js/foundation/foundation.reveal.js @@ -105,6 +105,13 @@ .on('closed.fndtn.reveal', '[data-reveal]', this.close_video); } + return true; + }, + + // PATCH #3: turning on key up capture only when a reveal window is open + key_up_on : function (scope) { + var self = this; + // PATCH #1: fixing multiple keyup event trigger from single key press $('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) { var open_modal = $('[data-reveal].open'), @@ -119,6 +126,12 @@ return true; }, + // PATCH #3: turning on key up capture only when a reveal window is open + key_up_off : function (scope) { + $('body').off('keyup.fndtn.reveal'); + return true; + }, + open : function (target, ajax_settings) { var self = this; if (target) { @@ -143,6 +156,7 @@ .data('offset', this.cache_offset(modal)); } + this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open modal.trigger('open'); if (open_modal.length < 1) { @@ -194,6 +208,7 @@ if (open_modals.length > 0) { this.locked = true; + this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open modal.trigger('close'); this.toggle_bg(modal); this.hide(open_modals, settings.css.close, settings);