From 76df09c9c28f192b4c08e7de8dfb233d636837c1 Mon Sep 17 00:00:00 2001 From: Kevin Ball Date: Thu, 25 Feb 2016 16:59:26 -0800 Subject: [PATCH] Fix bug where clicking inside reveal would close it --- js/foundation.reveal.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index 1b4264847..f4148d2d8 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -96,11 +96,6 @@ class Reveal { .addClass('reveal-overlay') .attr({'tabindex': -1, 'aria-hidden': true}) .appendTo('body'); - if (this.options.closeOnClick) { - $overlay.attr({ - 'data-close': id - }); - } return $overlay; } @@ -156,7 +151,10 @@ class Reveal { } if (this.options.closeOnClick && this.options.overlay) { - this.$overlay.off('.zf.reveal').on('click.zf.reveal', this.close.bind(this)); + this.$overlay.off('.zf.reveal').on('click.zf.reveal', function(e) { + if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; } + _this.close(); + }); } if (this.options.deepLink) { $(window).on(`popstate.zf.reveal:${this.id}`, this._handleState.bind(this)); -- 2.47.2