<script type="text/javascript">
if(typeof jQuery == 'undefined'){
document.write('<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js" integrity="sha512-aVKKRRi/Q/YV+4mjoKBsE4x3H+BkegoM/em46NNlCqNTmUYADjBbeNefNxYV7giUp0VxICtqdrbqU7iVaeZNXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></'+'script>');
}
</script>
<script>
jQuery(document).ready(function ($) {
const $tab10 = $('.tab-10').first();
var windowWidth = $(window).width();
if ($tab10.length) {
var accordionTabs = $('.tab-10-menu'); // To target all tabs, change this class to 'oxy-tabs'
// Find all the tabs that have our class
accordionTabs.each(function (index) {
// Find all the tabs inside
$(this).children(".tab-10-menu__wrap").each(function (index) {
let tabContent = $(this).html(); // Get the tab content
let countedContent = $(this).parent('.tab-10-menu').next('.tab-10-content').children('.tab-10-content__pane').eq(index); // Find the correct tab content
countedContent.before('<button class="tab-accordion">' + tabContent + '</button>'); // Create a accordion button
});
let accordionBtn = $(this).next('.tab-10-content').find(".tab-accordion");
let classList = $(this).children('.tab-10-menu__wrap').attr('class');
let activeClass = 'brx-open';
// move the classes onto the button, apart from the active class
accordionBtn.addClass(classList);
accordionBtn.removeClass(activeClass);
// Do all the accordion slidetoggle stuff, adding the unique active class where needed.
accordionBtn.click(function () {
$(this).next('.tab-10-content__pane').slideToggle();
if ($(this).hasClass(activeClass)) {
$(this).removeClass(activeClass);
} else {
$(this).next().siblings('.tab-10-content__pane').slideUp();
$(this).siblings('.tab-accordion').removeClass(activeClass);
$(this).addClass(activeClass);
}
});
});
// Maybe show the accordion buttons, depending if tabs are hidden
function maybeaccordion() {
if (windowWidth <= 1024) {
accordionTabs.each(function (index) {
let activeClass = 'brx-open';
let bricksTabContent = $(this).next('.tab-10-content').children('.tab-10-content__pane');
if ($(this).css('display') == 'none') {
$(this).next('.tab-10-content').find(".tab-accordion").show();
bricksTabContent.hide();
bricksTabContent.prev('.tab-accordion').removeClass(activeClass);
bricksTabContent.first().show();
bricksTabContent.first().prev().addClass(activeClass);
} else {
$(this).next('.tab-10-content').find(".tab-accordion").hide();
bricksTabContent.removeAttr("style");
}
});
} else {
accordionTabs.next('.tab-10-content').find('.tab-accordion').hide();
accordionTabs.next('.tab-10-content').children('.tab-10-content__pane').removeAttr('style');
}
}
//* Run on page load
maybeaccordion();
let $window = $(window);
$window.resize(function(){
//* Run again if page width changes
if ($window.width() != windowWidth) {
windowWidth = $window.width();
maybeaccordion();
}
});
}
});
</script>