]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Merge pull request #9685 from IamManchanda/hotfix/match-height-tabs
authorKevin Ball <kmball11@gmail.com>
Mon, 23 Jan 2017 18:13:06 +0000 (10:13 -0800)
committerKevin Ball <kmball11@gmail.com>
Mon, 23 Jan 2017 23:02:19 +0000 (15:02 -0800)
Match height tabs bug

js/foundation.tabs.js

index 907bf532387448baa9e45b089c375516aef2c046..bb60293b5f8bdec9bfe34a21d74917a234337852 100644 (file)
@@ -318,18 +318,22 @@ class Tabs {
    * Sets the height of each panel to the height of the tallest panel.
    * If enabled in options, gets called on media query change.
    * If loading content via external source, can be called directly or with _reflow.
+   * If enabled with `data-match-height="true"`, tabs sets to equal height
    * @function
    * @private
    */
   _setHeight() {
-    var max = 0;
+    var max = 0,
+        _this = this; // Lock down the `this` value for the root tabs object
+
     this.$tabContent
       .find(`.${this.options.panelClass}`)
       .css('height', '')
       .each(function() {
-        var panel = $(this),
-            isActive = panel.hasClass(`${this.options.panelActiveClass}`);
 
+        var panel = $(this),
+            isActive = panel.hasClass(`${_this.options.panelActiveClass}`); // get the options from the parent instead of trying to get them from the child
+            
         if (!isActive) {
           panel.css({'visibility': 'hidden', 'display': 'block'});
         }