Sha256: cea97685eefbdc311556dbcfd73b385f54c86637e33336896200194320d75625

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

/*
 * Tab 'Categories' expand/close effect.
 */

$(function() {
  const childPrefix = "l_";
  const parentPrefix = "h_";
  const collapse = $(".collapse");

  /* close up top-category */
  collapse.on("hide.bs.collapse", function () { /* Bootstrap collapse events. */
    const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
    if (parentId) {
      $(`#${parentId} .far.fa-folder-open`).attr("class", "far fa-folder fa-fw");
      $(`#${parentId} i.fas`).addClass("rotate");
      $(`#${parentId}`).removeClass("hide-border-bottom");
    }
  });

  /* expand the top category */
  collapse.on("show.bs.collapse", function() {
    const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
    if (parentId) {
      $(`#${parentId} .far.fa-folder`).attr("class", "far fa-folder-open fa-fw");
      $(`#${parentId} i.fas`).removeClass("rotate");
      $(`#${parentId}`).addClass("hide-border-bottom");
    }
  });

});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redeyed-jekyll-theme-0.1.2 _javascript/utils/category-collapse.js
redeyed-jekyll-theme-0.1.1 _javascript/utils/category-collapse.js