From 95aecca9d80396abcd695bf8603454924d97be59 Mon Sep 17 00:00:00 2001 From: Chris Oyler Date: Thu, 14 Jan 2016 16:08:22 -0800 Subject: [PATCH] fixes #7818, adds callback func to execute at modal closing completion --- js/foundation.reveal.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index 05b46fa4c..3d56592d3 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -422,6 +422,7 @@ Foundation.Motion.animateOut(this.$element, this.options.animationOut, function(){ if(_this.options.overlay){ Foundation.Motion.animateOut(_this.$overlay, 'fade-out', function(){ + finishUp(); }); } }); @@ -429,6 +430,7 @@ this.$element.hide(_this.options.hideDelay, function(){ if(_this.options.overlay){ _this.$overlay.hide(0, function(){ + finishUp(); }); } }); @@ -441,16 +443,23 @@ $('body').off('click.zf.reveal'); } this.$element.off('keydown.zf.reveal'); - - //if the modal changed size, reset it - if(this.changedSize){ - this.$element.css({ - 'height': '', - 'width': '' - }); + function finishUp(){ + //if the modal changed size, reset it + if(_this.changedSize){ + _this.$element.css({ + 'height': '', + 'width': '' + }); + } + $('body').removeClass('is-reveal-open').attr({'aria-hidden': false, 'tabindex': ''}); + _this.$element.attr({'aria-hidden': true}) + /** + * Fires when the modal is done closing. + * @event Reveal#closed + */ + .trigger('closed.zf.reveal'); } - $('body').removeClass('is-reveal-open').attr({'aria-hidden': false, 'tabindex': ''}); /** * Resets the modal content @@ -461,12 +470,6 @@ } this.isActive = false; - this.$element.attr({'aria-hidden': true}) - /** - * Fires when the modal is done closing. - * @event Reveal#closed - */ - .trigger('closed.zf.reveal'); if(_this.options.deepLink){ if(window.history.replaceState){ window.history.replaceState("", document.title, window.location.pathname); -- 2.47.2