Tabs that are XB tested and work smooth
<script>
// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
function openCity(evt, cityName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(cityName).style.display = "block";
evt.currentTarget.className += " active";
}
// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>
HTML
<div class="tab">
<button class="tablinks" id="defaultOpen" onclick="openCity(event, 'undergraduate')">MOUNTAIN STATS</button>
<button class="tablinks" onclick="openCity(event, 'advanced')">OUR TRAILS</button>
<div class="tile-container inliner">
<div id="undergraduate" class="tabcontent">
<div class="main-tile contact-tile">
<div class="main-content">
<div class="row">
<p>TOTAL PATROLLED AREA</p>
<p class="little-text"><?php the_field('stats-patrolled_area') ?></p>
</div>
<div class="row">
<p>VERTICAL DROP</p>
<p class="little-text"><?php the_field('stats-vertical_drop') ?></p>
</div>
<div class="row">
<p>SUMMIT ELEVATION</p>
<p class="little-text"><?php the_field('stats-summit_elevation') ?></p>
</div>
<div class="row">
<p>LONGEST RUN</p>
<p class="little-text"><?php the_field('stats-longest_run') ?></p>
</div>
<div class="row">
<p>SNOWMAKING</p>
<p class="little-text"><?php the_field('stats-snowmaking') ?></p>
</div>
<div class="row">
<p>ANNUAL SNOWFALL</p>
<p class="little-text"><?php the_field('stats-annual_snowfall') ?></p>
</div>
</div>
</div>
</div>
<div id="advanced" class="tabcontent">
<div class="main-tile contact-tile">
<div class="main-content">
<div class="row">
<p>NUMBER OF TRAILS</p>
<p class="little-text"><?php the_field('trails-number_of_trails') ?></p>
</div>
<div class="row">
<p>BEGINNER</p>
<p class="little-text"><?php the_field('trails-beginner') ?></p>
</div>
<div class="row">
<p>INTERMEDIATE</p>
<p class="little-text"><?php the_field('trails-intermediate') ?></p>
</div>
<div class="row">
<p>ADVANCED</p>
<p class="little-text"><?php the_field('trails-advanced') ?></p>
</div>
<div class="row">
<p>EXPERT</p>
<p class="little-text"><?php the_field('trails-expert') ?></p>
</div>
<div class="row">
<p>LIFTS</p>
<p class="little-text"><?php the_field('trails-lifts') ?></p>
</div>
<div class="row">
<p>TERRAIN PARK</p>
<p class="little-text"><?php the_field('trails-terrain_park') ?></p>
</div>
<div class="row">
<p>CROSS COUNTRY</p>
<p class="little-text"><?php the_field('trails-cross_country') ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>