<section id="css-transitions" class="animate-things-wrapper">
<button id="trigger">Trigger</button>
<div id="box" class="box">
Hi there
</div>
</section>
<script src="../../js/components/css-transitions.js"></script>
<section id="css-transitions" class="animate-things-wrapper">
<button id="trigger">Trigger</button>
<div id="box" class="box">
Hi there
</div>
</section>
<script src="{{ path '/js/components/css-transitions.js' }}"></script>
/* No context defined. */
(function () {
document.addEventListener('DOMContentLoaded', function () {
console.log("css-transitions active");
const button = document.querySelector('#trigger');
const box = document.querySelector('#box');
button.addEventListener('click', function() {
box.classList.toggle('active');
})
});
})();
#css-transitions {
.box {
transition: background-color 0.5s ease-in-out, color 0.5s ease-in-out;
&.active {
background-color: #ff00ff;
color: #ffffff;
}
}
}
No notes defined.