Created
April 27, 2021 10:38
-
-
Save ng-the-engineer/2efb56b6586763652ffd818496709f8a to your computer and use it in GitHub Desktop.
Code snippet of CV2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function switchTab(tab, selected, color) { | |
var contents = document.getElementsByClassName("tabContent"); | |
for (var i = 0; i < contents.length; i++) { | |
close(contents[i]); | |
} | |
var buttons = document.getElementsByClassName("tabButton"); | |
for (var i = 0; i < buttons.length; i++) { | |
changeColor(buttons[i], ""); | |
} | |
show(document.getElementById(tab)); | |
changeColor(selected, color); | |
} | |
function changeColor(el, color) { | |
el.style.backgroundColor = color; | |
} | |
function close(el) { | |
el.style.display = "none"; | |
} | |
function show(el) { | |
el.style.display = "block"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment