]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fixes #7818, adds callback func to execute at modal closing completion
authorChris Oyler <chris@zurb.com>
Fri, 15 Jan 2016 00:08:22 +0000 (16:08 -0800)
committerChris Oyler <chris@zurb.com>
Fri, 15 Jan 2016 00:08:22 +0000 (16:08 -0800)
js/foundation.reveal.js

index 05b46fa4cb4ed2dda1ad57f50aa689076fa128cc..3d56592d37f505905da6d411395f0353493b523b 100644 (file)
       Foundation.Motion.animateOut(this.$element, this.options.animationOut, function(){
         if(_this.options.overlay){
           Foundation.Motion.animateOut(_this.$overlay, 'fade-out', function(){
+            finishUp();
           });
         }
       });
       this.$element.hide(_this.options.hideDelay, function(){
         if(_this.options.overlay){
           _this.$overlay.hide(0, function(){
+            finishUp();
           });
         }
       });
       $('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
     }
 
     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);