Skip to main content
How to Load a Page with a Certain Tab Opened

Learn how to load a page with a specific tab opened to streamline navigation and enhance user experience when using the Tabs module.

Updated over a week ago

Enhancing user experience on your website often involves guiding visitors directly to the content they need. Loading a page with a specific tab opened can streamline navigation and ensure users find relevant information quickly.

Setting a default open tab can improve engagement and satisfaction if you want to highlight important details, promotions, or specific content sections.

This article will walk you through the steps to configure a page to load with a certain tab opened, making your site more intuitive and user-friendly.

  1. Open the page containing the Tabs module and enable the Visual Builder

  2. Open the Tabs module settings by clicking on the Gear icon

  3. Go to Advanced Tab → CSS ID & Classes → CSS ID and type in dt-tabs

    Divi Tabs Module CSS ID

  4. In your WordPress Menu or anywhere else on your website, add the link (this can also be used as the Button module's Link) as https://your-domain-name.com/page-slug/#dt-tabs|1

Note: The number of tabs is zero-based, that means:

  • https://your-domain-name.com/page-slug/#dt-tabs|1 - will open the second tab

  • https://your-domain-name.com/page-slug/#dt-tabs|2 - will open the third tab

  • etc

Load the page, scroll to the Tabs module, and open the selected Tab

If the Tabs module is somewhere down the pages, you can also use the following steps to let the browser scroll down to the Tabs module's location in the pages while the selected tab is opened

  1. Go to WordPress Dashboard → Divi → Theme Options → Integrations Tab

  2. Paste in this JS code

    <script>
    (function ($) {
    $(document).ready(function () {
    var hash = document.location.hash;

    if (hash) {
    var hashLenght = hash.match(/#(.*?)(.*?)(?=\|)/);

    if (hashLenght && hashLenght[0]) {
    var loggedIn = ($('#wpadminbar').length) ? $('#wpadminbar').outerHeight() : 0;
    var diviHeader = ($('#main-header').length) ? $('#main-header').outerHeight() : 0;
    var tbHeader = ($('.et-l.et-l--header .et_pb_sticky_module').length) ? $('.et-l.et-l--header .et_pb_sticky_module').outerHeight() : 0;
    var headerHeight = loggedIn + diviHeader + tbHeader;

    $('html, body').animate({
    scrollTop: ($(hashLenght[0]).offset().top - headerHeight)
    }, 500);
    }
    }
    });
    })(jQuery);
    </script>

The result can be seen in the GIF below:

Load the page, scroll to the Tabs module, and open the selected Tab
Did this answer your question?