Sha256: 62ede483752ef0cefede51fbaebff2e90dbd4bc75e2ffe9432e0ad7e7241f750
Contents?: true
Size: 801 Bytes
Versions: 46
Compression:
Stored size: 801 Bytes
Contents
export const showElement = (elem: any) => { elem.style.display = 'block'; const height = elem.scrollHeight + 'px'; // Get its height elem.style.height = height; // Update the max-height elem.classList.add('is-visible') // Once the transition is complete, remove the inline max-height so the content can scale responsively window.setTimeout(() => { elem.style.height = ''; }, 300); }; export const hideElement = (elem:any) => { elem.style.height = elem.scrollHeight + 'px'; window.setTimeout(() => { elem.style.height = '0'; elem.style.paddingTop = '0'; elem.style.paddingBottom = '0'; }, 1); // When the transition is complete, hide it window.setTimeout(() => { elem.classList.remove('is-visible'); }, 300); };
Version data entries
46 entries across 46 versions & 1 rubygems