-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
24 lines (20 loc) · 843 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function openTab(evt, tabName) {
var i, tabcontent, tablinks;
// Hide all tab content
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Remove the active class from all tab links
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab content, and add an "active" class to the button that opened the tab
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
// Set default tab to open
document.addEventListener("DOMContentLoaded", function() {
document.querySelector('.tablinks').click();
});