0
I created some tabs, when I move the mouse over each of them shows the color I sent but when I click to open the contents of the tab I would like to keep the color, showing which tab is open, instead of returning the original color, someone can give me a light?
Follow the css I’m using:
.tab {
overflow: hidden;
border: 1px solid #C25C40;
background-color: #262626;
border-radius:5px;
position:absolute;
top:160px;
left:360px;
z-index:110;
}
.tab button {
background-color: #262626;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 5px 10px;
transition: 0.3s;
color: white;
font: 600 13px Lato, sans-serif;
opacity:0.9;
z-index:110;
}
.tab button:hover {
background-color: #C25C40;
transition:.3s;
}
.tab button.active {
background-color: #C25C40;
}
.tabcontent {
display: none;
height: 670px;
width: 605px;
border: 1px solid #C25C40;
border-top: none;
color:white;
background-color:#262626;
border-radius:5px;
position:absolute;
top:189px;
left:438px;
z-index:110;
}
EDIT: Also follow the HTML and the script I’m using:
<div class="tab">
<button id="aba" class="tablinks" onclick="openTab('aba1')">Contatos</button>
<button class="tablinks" onclick="openTab('aba2')">Contas</button>
<button class="tablinks" onclick="openTab('aba3')">Representante</button>
<button class="tablinks" onclick="openTab('aba4')">Grupos de Produto</button>
<button class="tablinks" onclick="openTab('aba5')">Reclamações</button>
<button class="tablinks" onclick="openTab('aba6')">Multi-Empresa</button>
<button class="tablinks" onclick="openTab('aba7')">Produtos</button>
<button class="tablinks" onclick="openTab('aba8')">Qualidade</button>
</div>
function openTab(aba) {
var theArray= new Array('aba1', 'aba2', 'aba3', 'aba4', 'aba5', 'aba6', 'aba7', 'aba8');
for(i=0; i<theArray.length; i++){
if(theArray[i] == aba){
if (document.getElementById(aba).style.display=='none')
document.getElementById(aba).style.display='block';
else
document.getElementById(theArray[i]).style.display='none';
}else{
document.getElementById(theArray[i]).style.display='none';
}
}
}
Do you use any framework to generate tabs? How is your
HTML
?– Sorack
I’ve put the html and script I’m using. No, I’m not using the framework.
– Gabriel Midão