]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix bug where clicking inside reveal would close it
authorKevin Ball <kmball11@gmail.com>
Fri, 26 Feb 2016 00:59:26 +0000 (16:59 -0800)
committerKevin Ball <kmball11@gmail.com>
Fri, 26 Feb 2016 00:59:26 +0000 (16:59 -0800)
js/foundation.reveal.js

index 1b4264847340098884105c4d6d72e8bd4160a480..f4148d2d83ee7cea7109aa47c8a7ed4b567a6460 100644 (file)
@@ -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));