Sha256: 69e3e71c4cc555f1b484ec8db36419d8b653203f7aea9267d4cdad292d727f6e

Contents?: true

Size: 911 Bytes

Versions: 281

Compression:

Stored size: 911 Bytes

Contents

export const showElement = (elem: HTMLElement) => {
  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: HTMLElement) => {
  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

281 entries across 281 versions & 1 rubygems

Version Path
playbook_ui-14.3.0.pre.rc.2 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.PLAY1516railsiconsfixedwidth3674 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3671 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.1 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3669 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.pbntr373enablekitsforradio3665 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.bugfixforactionrc3663 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063653 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.play1490railsdialogdatafix3649 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063645 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063640 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063639 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063638 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063637 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063634 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063633 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.fixphonenumberinputflag3632 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.fixphonenumberinputflag3631 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063628 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts