Open a page with a specific Tab opened – DiviMenus Flex module

Choose the initially open tab when the page loads!

When you open a page that includes the Tabs module within Divi, the first tab is displayed as the default open tab. In this tutorial, you will learn how to recreate a Tabs module using the DiviMenus Flex module and have the second tab open by default when the page loads.

Paste this into DiviMenus → Advanced → CSS ID:
my-divimenu

If you set above an ID other than my-divimenu, please search the my-divimenu occurrences in the code below and change them for your custom ID.

Paste this into the Code Module*
jQuery(function($) {
if (window.location.hash) {
var hash = window.location.hash.substring(1);
if (!isNaN(parseInt(hash))) {
setTimeout(function() {
$('#my-divimenu .et_pb_divimenus_flex_item').eq(parseInt(hash)-1).find('.dd-mi>a').trigger('click');
}, 50);
}
}
});

* Place the previous code in between script tags:

<script>

THE CODE HERE

</script>

Now you can refer to each Menu Item by adding a parameter at the end of your page URL.

For example, to simulate a click to the 1st Menu Item add this parameter:

https://website.com/#1

Same for the remaining ones:

https://website.com/#2 (second Menu Item)
https://website.com/#3 (third Menu Item)

🥳 That’s it!

Want to link specific Tabs even more easily?

DonDivi Tabs module includes this functionality, which is part of our new plugin DonDivi Builder

👉 Subscribe to our YouTube channel

More Videos