One of the challenges I'm facing is with a video element that I want to hide gradually when clicking on another element. The issue is that after the animation completes, the video ends up hidden at the top-left corner of the screen instead of at the center where I want it to be. Any suggestions on how I can achieve this?
Please take a look at my code below:
const div = document.querySelector('div');
window.addEventListener('click', () => {
div.style.width = '0'
div.style.height = '0'
})
div {
width: 150px;
height: 150px;
background-color: blue;
transition: ease-in-out 2s;
}
<div></div>