Sha256: ca14f5434630593d93ba13181485b608e52241958f8c760d036ac6439ffc3288
Contents?: true
Size: 893 Bytes
Versions: 79
Compression:
Stored size: 893 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'); elem.style.overflow = "hidden" // Once the transition is complete, remove the inline max-height so the content can scale responsively window.setTimeout(() => { elem.style.height = ''; elem.style.overflow = "visible" }, 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'; elem.style.overflow = "hidden" }, 1); // When the transition is complete, hide it window.setTimeout(() => { elem.classList.remove('is-visible'); elem.style.overflow = "" }, 300); };
Version data entries
79 entries across 79 versions & 1 rubygems