Home Forums WoodMart support forum Accordion tabs closed (single product description , etc)

Accordion tabs closed (single product description , etc)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #71074

    piannikov
    Participant

    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.
    #71085

    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

    #71123

    piannikov
    Participant

    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.

    #71141

    We are glad you have solved the issue. If you have any questions please feel free to contact us.

    Best Regards

    #72545

    piannikov
    Participant

    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
    }
    #72563

    Artem Temos
    Keymaster

    Thank you for posting it here 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Accordion tabs closed (single product description , etc)’ is closed to new replies.