Skip to content

Commit 7e27c5d

Browse files
committed
New Pages Updates 2
-- Dynamic height for the tabs only if not set specifically on the class
1 parent 7cba39a commit 7e27c5d

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

src/tabs.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,22 @@ export function initTabs() {
178178

179179
const newHeight = $wrap.height();
180180

181-
$wrap.css('height', currentHeight);
182-
gsap.to($wrap, {
183-
height: newHeight,
184-
duration: 0.4,
185-
ease: 'power2.out',
186-
onComplete: () => {
187-
$wrap.css('height', 'auto');
188-
},
189-
});
181+
const computedHeight = window.getComputedStyle($wrap[0]).height;
182+
const inlineHeight = $wrap[0].style.height;
183+
184+
if (!inlineHeight) {
185+
$wrap.css('height', currentHeight);
186+
gsap.to($wrap, {
187+
height: newHeight,
188+
duration: 0.4,
189+
ease: 'power2.out',
190+
onComplete: () => {
191+
$wrap.attr('style', '');
192+
},
193+
});
194+
} else {
195+
$wrap.css('height', 'auto');
196+
}
190197

191198
if ($targetContent.is('ul, ol, li')) {
192199
const $items = $targetContent.find('li').add('[data-tabs="content-item"]');

0 commit comments

Comments
 (0)