I found this javascript code that does what I am looking for.
The only issue is, it is in jquery.
I'm trying to change it to vanilla javascript.
Is there someone who can help me with this?
https://jsfiddle.net/c7or0vgp/
$('.curtain').click(function() {
$('.fadeout').delay(500).fadeOut(3000, function() {
$(this).remove();
});
});
Which would then be added to this code.
https://jsfiddle.net/07gstwmx/
(function iife() {
"use strict";
function show(el) {
el.classList.remove("hide");
}
function hide(el) {
el.classList.add("hide");
}
function coverClickHandler(evt) {
const cover = evt.currentTarget;
hide(cover);
const curtain = document.querySelector(".curtain");
curtain.classList.add("slide");
const thewrap = curtain.parentElement.querySelector(".container");
show(thewrap);
}
const cover = document.querySelector(".jacketa");
cover.addEventListener("click", coverClickHandler);
}());