Home › Forums › Space themes support forum › Single product accordeon tabs
Single product accordeon tabs
- This topic has 4 replies, 2 voices, and was last updated 4 hours, 46 minutes ago by John.
-
AuthorPosts
-
January 23, 2025 at 11:38 pm #632361
JohnParticipantHello guys,
I m trying with this js to close the first tab of accordeon. After i open the first tab from accordeon and i want to click on the second tab of the accordeon to open it i want to automaticaly close the first tab.
Attached in privet the code and the website link. We are using vega theme.
Can you guys help me?
Thank you!January 24, 2025 at 11:22 am #632410
Luke NielsenKeymasterHello,
Try to create a preset for the Product page and in Performance -> Script never load -> disable the Accordion element init: https://monosnap.com/file/s3cA0cetM3Sewscyxuv8nYYgwKugBe
https://monosnap.com/file/XMnbwz3mBOBjLiWFtCWjUW4cTOfzf2
Kind Regards
January 24, 2025 at 2:59 pm #632482
JohnParticipantHey Luke, many thanks for fast answer.
Actually doing what you said blocks the javascript to load on the page, corect?
I would like if possible to have the first tab closed by default and if other tabs are opened to closed previous one.
Thank you again for your support.January 24, 2025 at 6:03 pm #632566
Luke NielsenKeymasterHello,
In this case, remove the previously created preset and put the below custom to Theme settings -> Custom js -> Global js.
jQuery(document).ready(function ($) { setTimeout(function () { var $firstAccordionItem = $('.xts-accordion-item').first(); if ($firstAccordionItem.length) { var $content = $firstAccordionItem.find('.xts-accordion-content'); var $title = $firstAccordionItem.find('.xts-accordion-title'); if ($content.length) { $content.css('display', 'none'); } if ($title.length) { $title.removeClass('xts-active'); } $firstAccordionItem.removeClass('xts-active'); } }, 10); $('.wc-tabs-wrapper').each(function () { var $wrapper = $(this); var $tabTitles = $wrapper.find('.xts-accordion-title'); var $tabContents = $wrapper.find('.xts-accordion-content'); var activeClass = 'xts-active'; var time = 300; $tabTitles.on('click', function () { $clickedTitle = $(this); $clickedContent = $(this).parent().find('.xts-accordion-content'); $tabTitles.not($clickedTitle).removeClass(activeClass); $tabContents.not($clickedContent).stop().slideUp(time).removeClass(activeClass); }); }); });
Clear the cache and check how it works.
Kind Regards
January 24, 2025 at 6:06 pm #632567
JohnParticipantLukas, you are the man. Many thanks and much appreciation. Works flawless. Please consider add this feature in the future :D. Thanks again and have a wonderful weekend.
Again much pleased with xtemos support. Top notch. -
AuthorPosts
- You must be logged in to create new topics. Login / Register