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.2.0.pre.alpha.PLAY15063626 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063624 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.play1432playgroundsanitation3622 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063621 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063620 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063619 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.0.pre.alpha.PLAY15063618 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.0 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063617 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063616 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063615 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063614 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063613 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063612 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PLAY15063610 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PBNTR417addcolorsupdatedefaultcolor3608 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PBNTR449rtepreviewerrails3605 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PA1477timestampkit3601 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.PBNTR462starratingdefaultvalue3600 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.1.0.pre.alpha.pbntr373enablekitsforradio3595 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts