<section id="css-transitions-directional" class="animate-things-wrapper">
<button id="trigger">Trigger</button>
<div id="box" class="box">
Hi there
</div>
</section>
<script src="../../js/components/css-transitions-directional.js"></script>
<section id="css-transitions-directional" 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-directional.js' }}"></script>
/* No context defined. */
(function () {
document.addEventListener('DOMContentLoaded', function () {
console.log("css-transitions-directional active");
const button = document.querySelector('#trigger');
const box = document.querySelector('#box');
button.addEventListener('click', function() {
box.classList.toggle('active');
})
});
})();
#css-transitions-directional {
// The transition is on the target state: transition quickly to active, slowly back to the start
.box {
transform: scale(1, 1) translate(0, 0) rotate(0);
transition: transform 3s ease-out;
&.active {
transform: scale(2, 2) translate(0, 50%) rotate(45deg);
transition: transform 0.05s ease-in;
}
}
}
No notes defined.