https://i.sstatic.net/1qgWt.png
Is there a way to create a fade out effect in JavaScript? In the image provided, you can see that when you click on a day, a box slides down. If you click on another day, the previous box slides back up while a new box slides down to replace it.
function mon() {
var elem = document.getElementById("box");
document.getElementById("box").style.background = "#ffba08";
var pos = 0;
var id = setInterval(frame, 5);
function frame() {
if (pos == 200) {
clearInterval(id);
} else {
pos++
elem.style.top = pos + "px";
}
}
}
This is the code I use for implementing this JavaScript effect.