I want to add a transition duration so that when you click the card the text underneath displays a bit slower. Right now if you click it immediately shows the text. It may be simple css thing but I can't seem to figure it out. I tried adding a transition duration to the .hidden class but nothing?
function openDropdown(dropdownId) {
var allDropdowns = ["dropdown1", "dropdown2", "dropdown3", "dropdown4"];
const index = allDropdowns.indexOf(dropdownId);
allDropdowns.splice(index, 1);
document.getElementById(dropdownId).classList.toggle("hidden");
for (var i = 0; i < allDropdowns.length; i++) {
document.getElementById(allDropdowns[i]).classList.add("hidden");
}
}
.card-row {
display: flex;
justify-content: space-evenly;
align-items: center;
background-image: url(./images/forest.jpg);
background-position: center;
background-repeat: none;
padding: 3em;
}
.card {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 1em;
backdrop-filter: blur(5px);
border-radius: 4px;
background-color: rgba(255, 255, 255, 0.5);
box-shadow: 2px 3px 5px rgba(17, 17, 17, 0.3);
margin: 1em;
max-width: 150px;
color: whitesmoke;
text-align: center;
}
.card-glass {
background-color: rgba(83, 83, 83, 0.1);
box-shadow: 2px 2px 4px rgba(17, 17, 17, 0.5);
}
.card:hover {
background-color: #202020;
}
.card i {
box-shadow: 2px 3px 10px rgba(0, 0, 0, 0);
font-size: 2.5em;
color: #272727;
padding: 1em;
}
.fa-html5:hover {
color: red;
}
.fa-css3-alt:hover {
color: dodgerblue;
}
.fa-js:hover {
color: gold;
}
.fa-react:hover {
color: fuchsia;
}
.hidden {
display: none;
}
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
<div class="card-row">
<div class="card-glass">
<div class="card">
<i onclick="openDropdown('dropdown1')" class="fab fa-html5"></i>
<div id="dropdown1" class="hidden">HTML5 with better management of web applications and content.</div>
</div>
</div>
<div class="card-glass">
<div class="card">
<i onclick="openDropdown('dropdown2')" class="fab fa-css3-alt"></i>
<div id="dropdown2" class="hidden">Cascading Style Sheets with new features to bring your ideas to life.
</div>
</div>
</div>
<div class="card-glass">
<div class="card">
<i onclick="openDropdown('dropdown3')" class="fab fa-js"></i>
<div id="dropdown3" class="hidden">JavaScript, the language of the web with new features in ES6</div>
</div>
</div>
<div class="card-glass">
<div class="card">
<i onclick="openDropdown('dropdown4')" class="fab fa-react"></i>
<div id="dropdown4" class="hidden">React and React Native framework for rapid development</div>
</div>
</div>
</div>
Let me know if anything else is needed.