I'm attempting to create a dynamic footer that expands to reveal additional information when clicked, and then contracts back to its original state upon clicking a specific icon. The goal is to toggle between displaying time information and hiding it.
Even after trying to utilize jquery for altering the CSS properties and adding/removing classes, I haven't been able to achieve the desired functionality.
<div class="footer" onclick="showTimes()">
<i class="fas fa-times-circle hidden" onclick="hideTimes()"></i>
<div id="timeDiv" class="time"></div>
</div>
function showTimes(){
$(".footer").css("height", "40%");
$("#timeDiv").addClass( "hidden" );
$(".fa-times-circle").removeClass( "hidden" );
}
function hideTimes(){
$("#timeDiv").removeClass( "hidden" );
$(".fa-times-circle").addClass( "hidden" );
$(".footer").animate({height:'10%'},400);
}
.footer {
background-color: #211f20;
width: 70%;
height: 10%;
right: 10px;
position: fixed;
bottom: 0px;
z-index: 1;
opacity: 0.7;
cursor: pointer;
}
.footer:hover {
height: 12.5%; !important;
webkit-transition:height 0.5s; /* Safari */ !important;
transition:height 0.5s; !important;
}
.time {
color: white;
font-family: 'Montserrat', sans-serif;
font-size: 2vh;
position: absolute;
bottom: 20%;
width: 100%;
text-align: center;
display: inline-block;
}
.fa-times-circle {
color: white;
font-size: 5vh;
position: absolute;
top: 0;
right: 0;
margin: 20px 20px 0px 0px;
}
My expectation was for the button to disappear upon clicking, and for the "timeDiv" to become visible again with the footer reverting to its original size.