]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Remove the transitionend listener for the content container
authorSassNinja <kai.falkowski@gmail.com>
Fri, 16 Jun 2017 09:13:20 +0000 (11:13 +0200)
committerSassNinja <kai.falkowski@gmail.com>
Fri, 16 Jun 2017 09:13:20 +0000 (11:13 +0200)
Since the limited version doesn't enable push transitions for nested elements, there's no need to listen on the content because the element always gets moved.

js/foundation.offcanvas.js

index 9d7a90ea8b8ef69e10bc89a54076c37067f51d23..621a2ff4a49bd2dc86aee21b96622bcc18acee11 100644 (file)
@@ -294,7 +294,7 @@ class OffCanvas extends Plugin {
      * Fires when the off-canvas menu opens.
      * @event OffCanvas#opened
      */
-    _this.$element.addClass('is-open').removeClass('is-closed');
+    this.$element.addClass('is-open').removeClass('is-closed');
 
     this.$triggers.attr('aria-expanded', 'true');
     this.$element.attr('aria-hidden', 'false')
@@ -350,7 +350,7 @@ class OffCanvas extends Plugin {
 
     var _this = this;
 
-    _this.$element.removeClass('is-open');
+    this.$element.removeClass('is-open');
 
     this.$element.attr('aria-hidden', 'true')
       /**
@@ -383,23 +383,10 @@ class OffCanvas extends Plugin {
       Keyboard.releaseFocus(this.$element);
     }
 
-    // Listen to transitionEnd  and add class when done.
-    // Listening to both, element and content, is required because they don't always transform together (e.g. on nested push transition).
-    this.$content.one(Foundation.transitionend(this.$content), function(e) {
-      if (e.originalEvent.propertyName.match(/transform/i)) {
-        _this.$element.off(Foundation.transitionend(this.$content)); // unbind $element listener since it hasn't transformed
-        _this.$element.addClass('is-closed');
-        _this.$content.off(Foundation.transitionend(_this.$content));
-        _this._removeContentClasses();
-      }
-    });
+    // Listen to transitionEnd and add class when done.
     this.$element.one(Foundation.transitionend(this.$element), function(e) {
-      if (e.originalEvent.propertyName.match(/transform/i)) {
-        _this.$content.off(Foundation.transitionend(this.$element)); // unbind $content listener since it hasn't transformed
-        _this.$element.addClass('is-closed');
-        _this.$content.off(Foundation.transitionend(_this.$content));
-        _this._removeContentClasses();
-      }
+      _this.$element.addClass('is-closed');
+      _this._removeContentClasses();
     });
   }