const button = document.querySelector('button');
const box = document.querySelector('.box');
button.addEventListener('click', () => {
box.classList.toggle('hide');
})
.box {
width:200px;
height: 200px;
border: 1px solid #000;
background-color: gray;
margin: 0 auto;
opacity: 1;
display: block;
}
.hide {
display: none;
transition: all 1s ease-out;
opacity: 0;
}
const button = document.querySelector('button');
const box = document.querySelector('.box');
button.addEventListener('click', () => {
box.classList.toggle('hide');
})
.box {
width:200px;
height: 200px;
border: 1px solid #000;
background-color: gray;
margin: 0 auto;
opacity: 1;
transition: all 1s ease-out;
visibility: visible;
}
.hide {
visibility: hidden;
transition: all 1s ease-out;
opacity: 0;
}
const button = document.querySelector('button');
const box = document.querySelector('.box');
button.addEventListener('click', () => {
box.classList.toggle('hide');
})
.box {
width:200px;
height: 200px;
border: 1px solid #000;
background-color: gray;
margin: 0 auto;
opacity: 1;
transition: all 1s ease-out;
display: block;
}
.hide {
transition: all 1s ease-out;
opacity: 0;
}