2019-09-30 15:38:41 +03:00
|
|
|
/*
|
|
|
|
* Tab 'Categories' expand/close effect.
|
2020-01-02 16:17:49 +03:00
|
|
|
* v2.0
|
|
|
|
* https://github.com/cotes2020/jekyll-theme-chirpy
|
2019-09-30 15:38:41 +03:00
|
|
|
* © 2018-2019 Cotes Chung
|
|
|
|
* MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
var child_prefix = "l_";
|
|
|
|
var parent_prefix = "h_";
|
|
|
|
|
2020-05-29 19:48:10 +03:00
|
|
|
/* close up top-category */
|
|
|
|
$(".collapse").on("hide.bs.collapse", function() { /* Bootstrap collapse events. */
|
2019-09-30 15:38:41 +03:00
|
|
|
var parent_id = parent_prefix + $(this).attr('id').substring(child_prefix.length);
|
|
|
|
if (parent_id) {
|
|
|
|
$("#" + parent_id + " .far.fa-folder-open").attr("class", "far fa-folder fa-fw");
|
2019-11-22 19:42:14 +03:00
|
|
|
$("#" + parent_id + " i.fas").addClass("rotate");
|
2019-09-30 15:38:41 +03:00
|
|
|
$("#" + parent_id).removeClass("hide-border-bottom");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-29 19:48:10 +03:00
|
|
|
/* expand the top category */
|
2019-09-30 15:38:41 +03:00
|
|
|
$(".collapse").on("show.bs.collapse", function() {
|
|
|
|
var parent_id = parent_prefix + $(this).attr('id').substring(child_prefix.length);
|
|
|
|
if (parent_id) {
|
|
|
|
$("#" + parent_id + " .far.fa-folder").attr("class", "far fa-folder-open fa-fw");
|
2019-11-22 19:42:14 +03:00
|
|
|
$("#" + parent_id + " i.fas").removeClass("rotate");
|
2019-09-30 15:38:41 +03:00
|
|
|
$("#" + parent_id).addClass("hide-border-bottom");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|