When using the Tabs component in Oxygen, the first one will be the active tab by default.

To make a different tab say, the third one to be active on page load, the common approach is to trigger click on the tab or remove and add active classes using JavaScript. But we can use just the order CSS property and get this done.

Here’s how.

Step 1

Position the title and contents of the tab that should be highlighted on page load at the top in the structure.

third tab and its contents are moved to the top

Step 2

At Manage > Stylesheets add this CSS:

/* Change tabs order */
/* 1, 2, 3 should become 3, 1, 2 */

#_tabs-22-82 :nth-child(1) {
  order: 3;
}

#_tabs-22-82 :nth-child(2) {
  order: 1;
}

#_tabs-22-82 :nth-child(3) {
  order: 2;
}

replace all instances of _tabs-22-82 with the ID of your Tabs component.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

You need to be logged in to view and post comments.
Not a member yet? Join here.
magnifiercross
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: