]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Trigger events after animation is complete 7727/head
authorNate Wiebe <nate@northern.co>
Wed, 30 Dec 2015 20:33:56 +0000 (15:33 -0500)
committerNate Wiebe <nate@northern.co>
Wed, 30 Dec 2015 20:33:56 +0000 (15:33 -0500)
js/foundation.accordion.js
js/foundation.accordionMenu.js

index 59a8651a4a3fd41f2e71e6ccfc70763406802bcc..9c1ee8333e350c20dff4fe31300716ab6bfed438 100644 (file)
       .parent().addClass('is-active');
 
     // Foundation.Move(_this.options.slideSpeed, $target, function(){
-      $target.slideDown(_this.options.slideSpeed);
+      $target.slideDown(_this.options.slideSpeed, function () {
+        /**
+         * Fires when the tab is done opening.
+         * @event Accordion#down
+         */
+        _this.$element.trigger('down.zf.accordion', [$target]);
+      });
     // });
 
     // if(!firstTime){
       'aria-expanded': true,
       'aria-selected': true
     });
-    /**
-     * Fires when the tab is done opening.
-     * @event Accordion#down
-     */
-    this.$element.trigger('down.zf.accordion', [$target]);
   };
 
   /**
     }
 
     // Foundation.Move(this.options.slideSpeed, $target, function(){
-      $target.slideUp(_this.options.slideSpeed);
+      $target.slideUp(_this.options.slideSpeed, function () {
+        /**
+         * Fires when the tab is done collapsing up.
+         * @event Accordion#up
+         */
+        _this.$element.trigger('up.zf.accordion', [$target]);
+      });
     // });
 
     $target.attr('aria-hidden', true)
      'aria-expanded': false,
      'aria-selected': false
    });
-
-    /**
-     * Fires when the tab is done collapsing up.
-     * @event Accordion#up
-     */
-    this.$element.trigger('up.zf.accordion', [$target]);
   };
 
   /**
index d698a9d8cf714886abb281b7b07db0ed833b7234..70a6b9accd32355b5323a60b10d3b39fa1658a62 100644 (file)
       .parent('.has-submenu').attr({'aria-expanded': true, 'aria-selected': true});
 
       Foundation.Move(this.options.slideSpeed, $target, function(){
-        $target.slideDown(_this.options.slideSpeed);
+        $target.slideDown(_this.options.slideSpeed, function () {
+          /**
+           * Fires when the menu is done opening.
+           * @event AccordionMenu#down
+           */
+          _this.$element.trigger('down.zf.accordionMenu', [$target]);
+        });
       });
-    /**
-     * Fires when the menu is done collapsing up.
-     * @event AccordionMenu#down
-     */
-    this.$element.trigger('down.zf.accordionMenu', [$target]);
   };
 
   /**
   AccordionMenu.prototype.up = function($target) {
     var _this = this;
     Foundation.Move(this.options.slideSpeed, $target, function(){
-      $target.slideUp(_this.options.slideSpeed);
+      $target.slideUp(_this.options.slideSpeed, function () {
+        /**
+         * Fires when the menu is done collapsing up.
+         * @event AccordionMenu#up
+         */
+        _this.$element.trigger('up.zf.accordionMenu', [$target]);
+      });
     });
     $target.attr('aria-hidden', true)
            .find('[data-submenu]').slideUp(0).attr('aria-hidden', true).end()
     // $target.slideUp(this.options.slideSpeed, function() {
     //   $target.find('[data-submenu]').slideUp(0).attr('aria-hidden', true);
     // }).attr('aria-hidden', true).parent('.has-submenu').attr({'aria-expanded': false, 'aria-selected': false});
-
-    /**
-     * Fires when the menu is done collapsing up.
-     * @event AccordionMenu#up
-     */
-    this.$element.trigger('up.zf.accordionMenu', [$target]);
   };
 
   /**