I can't seem my Function to actually run I managed to get it to Implement but the issue was you had to reload the script which I don't want I wanted it to run whenever someone resizes the site window.
But when I get to 900px, it doesn't actually show the content and the function's not working correctly, The Reason for this function is that I have tabbed content that on a bigger screen should only have there visibility reduced so so the spacing is correct but on mobile its taking a full 12 columns so it needs to start hiding the content with its spacing all together else I end up with
item1
item2
item3
etc
Let me know if any further material needs to be provided.
window.onresize = function() {
if (window.innerWidth <= 900) {
function openCity(evt, cityName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("wedo-tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
tabcontent[i].style.opacity = "0";
}
tablinks = document.getElementsByClassName("wedo-tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName).style.display = "block";
document.getElementById(cityName).style.opacity = "1";
evt.currentTarget.className += " active";
}
document.getElementById("defaultOpen").click();
}
}
<div class=" wedo-tab mg-top-m">
<button id="defaultOpen" class="wedo-tablinks" onclick="openCity(event, '1')">01</button>
<img class="steps-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/Asset-15.png">
<button class="wedo-tablinks" onclick="openCity(event, '2')">02</button>
<img class="steps-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/Asset-15.png">
<button class="wedo-tablinks" onclick="openCity(event, '3')">03</button>
<img class="steps-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/Asset-15.png">
<button class="wedo-tablinks" onclick="openCity(event, '4')">04</button>
<img class="steps-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/Asset-15.png">
<button class="wedo-tablinks" onclick="openCity(event, '5')">05</button>
</div>
<div class="row ab-contents">
<div id="1" class="col-lg-2 col-sm-12 wedo-tabcontent">
<h4>BRIEF</h4>
<p>It all starts with coffee. We want to sit down with you and get to know your brand and what makes it tick. We want you to explain your brief so that our team can get cracking on finding the right solution</p>
</div>
<div id="2" class="col-lg-2 col-sm-12 wedo-tabcontent">
<h4>BRIEF</h4>
<p>It all starts with coffee. We want to sit down with you and get to know your brand and what makes it tick. We want you to explain your brief so that our team can get cracking on finding the right solution</p>
</div>
<div id="3" class="col-lg-2 col-sm-12 wedo-tabcontent">
<h3>Tokyo</h3>
<p>Tokyo is the capital of Japan.</p>
</div>
<div id="4" class="col-lg-2 col-sm-12 wedo-tabcontent">
<h3>Tokyo</h3>
<p>Tokyo is the capital of Japan.</p>
</div>
<div id="5" class="col-lg-2 col-sm-12 wedo-tabcontent">
<h3>Tokyo</h3>
<p>Tokyo is the capital of Japan.</p>
</div>
</div>