Untitled
unknown
plain_text
16 days ago
872 B
10
Indexable
Never
const text = document.getElementById('type-element').innerHTML; const hiddenElement = document.getElementById('type-hidden-element'); hiddenElement.innerHTML = text; const fullHeight = hiddenElement.offsetHeight; new TypeIt("#type-element", { speed: 5, waitUntilVisible: true, cursor: false, html: true, loop: false, afterComplete: async (instance) => { updateElementHeight(); }, beforeStep: async (instance) => { updateElementHeight(); }, }).go(); function updateElementHeight() { const updatedFullHeight = hiddenElement.offsetHeight; document.getElementById('type-element').style.height = updatedFullHeight + 'px'; } window.addEventListener('resize', function() { updateElementHeight(); });
Leave a Comment