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

Version Path
playbook_ui-13.14.0.pre.alpha.PLAY1109bugdisplaypropblocksfontcolor1784 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.14.0.pre.alpha.play1106filter1751 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.14.0.pre.alpha.play1106filter1748 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.14.0 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.13.0.pre.alpha.PLAY1097linterenhancedelement1728 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.13.0.pre.alpha.play10221678 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.13.0.pre.alpha.PLAY1090csstokens1675 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.13.0.pre.alpha.play900startratingasinput1657 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.13.0 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exportingtypes1627 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exportingtypes1626 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1624 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1623 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.play900startratingasinput1612 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1611 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1609 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1608 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.play10281596 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-13.12.0.pre.alpha.play1051testhighcharts1581 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts