This tutorial will provide you some relatively simple JavaScript code to add in Oxygen Builder so that you can enable linking to tabs on the front end. If you have a tabs component on a page and want to be able to link directly to an inner tab, you can do that with this code below.
Add code below in a code block in the JavaScript tab inside Oxygen.
var pathname = window.location.href;
jQuery(document).ready( function() {
function tab_reset() {
//Remove active state from all tabs
jQuery('.oxy-tabs-wrapper > *').removeClass('tabs-1086-tab-active');
//Hide all tab contents
jQuery('.oxy-tabs-contents-wrapper > *').addClass('oxy-tabs-contents-content-hidden');
}
if( pathname.includes('#account') ) {
tab_reset();
jQuery('#_tab-12-12').addClass('tabs-1086-tab-active');
jQuery('#_tab_content-19-12').removeClass('oxy-tabs-contents-content-hidden');
} else if ( pathname.includes('#posts') ) {
tab_reset();
jQuery('#_tab-13-12').addClass('tabs-1086-tab-active');
jQuery('#_tab_content-20-12').removeClass('oxy-tabs-contents-content-hidden');
} else if ( pathname.includes('#downloads') ) {
tab_reset();
jQuery('#_tab-14-12').addClass('tabs-1086-tab-active');
jQuery('#_tab_content-21-12').removeClass('oxy-tabs-contents-content-hidden');
} else if ( pathname.includes('#membership') ) {
tab_reset();
jQuery('#_tab-15-12').addClass('tabs-1086-tab-active');
jQuery('#_tab_content-22-12').removeClass('oxy-tabs-contents-content-hidden');
}
});
Learn more about my Oxygen Builder course here: https://jonathanjernigan.com/ultimate-oxygen-course/
