Accordion tabs closed (single product description , etc)
-
Hello,
When the single product page is drawn, the accordion appears with the tabs closed and when the page is fully loaded, the “description” tab becomes opened. How to make sure that all tabs of the accordion are closed after loading the page.
I tried to do this through a document.ready function $('#tab-description').css('display','none');
, the accordion becomes closed, but to open it is necessary to click twice. Please help to do this.
Attachments:
You must be
logged in to view attached files.
Hello,
Please add this code snippet to the Custom JS section in Theme Settings:
setTimeout(function() {
var $tab = jQuery('.basel-tab-wrapper').find('a.active');
$tab.siblings('.wc-tab').hide();
$tab.removeClass('active');
}, 10);
Best Regards
For some reason this code does not work.
I wrote this snippet:
setTimeout(function() {
document.getElementsByClassName('woodmart-accordion-title')[0].click();
}, 2000);
I think that it will not work correctly, in some cases.
We are glad you have solved the issue. If you have any questions please feel free to contact us.
Best Regards
this message is for people who have a similar problem 🙂
if you have a woodmart theme, , then the correct snippet:
setTimeout(function() {
var $tab = jQuery('.woodmart-tab-wrapper').find('a.active');
console.log($tab);
$tab.siblings('.wc-tab').hide();
$tab.removeClass('active');
}, 10);
Also if you use “tabs” in theme settings, this code breaks the markup for desktops.
Use :
function isMobile() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
if (isMobile()) {
//script
}
Thank you for posting it here 🙂
The topic ‘Accordion tabs closed (single product description , etc)’ is closed to new replies.