I am trying to just use vanilla javascript instead of jQuery and to fade an element out I am using css and js.
My css:
.fade-out {
visibility: hidden;
opacity: 0;
transition: visibility 0s 2s, opacity 2s linear;
}
The js:
const approveBox = document.querySelector('.dashboard-list-box');
approveBox.classList.add('fade-out');
This works but the problem is that it leaves a gaping hole in the page when the element fades out instead of shifting the content below upwards like it would with using jQuery fadeOut().
If I replace visibility: hidden with
display: none
Then it just disappears instantly without fading. Is there a way around this?