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