I want to transition this h1 when we click on the button, the html for the h1
is added using js, so it is dynamic, I can't specify the opacity 0 and other before the button click, what is the way to do this?
const wow = document.getElementById('wow');
const test = document.querySelector('.test');
wow.addEventListener('click', () => {
test.innerHTML = `
<h1 class="title">
Hello Test
</h1>
`;
})
.title {
opacity: 1;
transform: translateY(0);
transition: transform 1s cubic-bezier(.165,.84,.44,1) .1s,opacity 1s cubic-bezier(.165,.84,.44,1) .2s;
}
<div class="test"></div>
<button id="wow">
Click
</button>