Tabbed Content - Target A Specific Tab When A Button Is Clicked

Hi there

We use Cornerstone Version 7.4.9 and Theme x Version 10.4.9 with a custom child theme. We also use Woocommerce.

For tabbed content, we are still using the classic tabs.

What we would like to do for our Woocommerce products is have our jump link which is a button in the product short description target a specific tab when clicked rather than target the first tab on the left.

For example see this product https://www.mitegen.com/product/cryo-express-dry-shipper-cx100/

Click the button entitled Ask Question/Request Quote. This jumps you down to the tabbed content. But it does not target the tab named Ask Question/Request Quote.

Here is the code for that button -> [x_button shape=“rounded” size=“mini” float=“none” href="#cs-content" info=“none” info_place=“top” info_trigger=“hover”]Ask Question/Request Quote[/x_button]

I would assume we have to do two things. First modify the href="#cs-content" and then add something to the tab named Ask Question/Request Quote.

Please let me know if this is possible and if so how to achieve it.

Thank you
Tim

Hi Tim,

Thanks for reaching out.
You can set a ID to the Button and also set a ID to the specific tab. I have added the btn ID to Button and tab2 to the Tab2, and also added the following code into the Page JS.

jQuery(document).ready(function($){
    jQuery('#btn').click(function()
    {
        jQuery('#tab-tab2').trigger('click');
        console.log('hello');
    });
});

Please remember that the above code will work if copied as it is and doesn’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes which means we can’t fix it in case it conflicts with something on your site nor will we enhance it. Further customization should be directed to a third-party developer or you can avail of One, where we answer the questions beyond normal theme support.

Thanks

@tristup Thank you!

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.