I'm currently working on incorporating an animation into a div that I am toggling between showing and hiding with a button click. While I have the desired animation, I am unsure of how to trigger it using JavaScript when the button is clicked. Can anyone provide assistance with this issue?
https://codepen.io/mattmcgilton/pen/JjjbGMB
.reveal-content {
animation: slide-in-fwd-center 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}
@keyframes slide-in-fwd-center {
0% {
transform: translateZ(-1400px);
opacity: 0;
}
100% {
transform: translateZ(0);
opacity: 1;
}
}
var x = document.getElementById("reveal-content").style.display = "none";
document.getElementById("btn-reveal").addEventListener('click', function() {
var x = document.getElementById("reveal-content");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
});