Skip to content

Instantly share code, notes, and snippets.

@chiroleen
Last active July 23, 2022 03:27
Show Gist options
  • Save chiroleen/6159890015f86e1c681bae6c9c0e34a2 to your computer and use it in GitHub Desktop.
Save chiroleen/6159890015f86e1c681bae6c9c0e34a2 to your computer and use it in GitHub Desktop.
// カテゴリ、月別アーカイブの表示に関する関数(jQuery利用)
// @link https://api.jquery.com/ready/
jq2 = jQuery.noConflict();
jq2(function ($) {
$(".archive-list >li").click(function () {
if ($(this).next(".month-archive-list").is(":visible") || $(this).hasClass("acv_open")) { //既に開いている場所なら
$(".month-archive-list", this).slideUp("fast"); //閉じる
$(this).removeClass("acv_open");
}
else { //閉じている場所なら
$(this).siblings().children(".month-archive-list").slideUp("fast"); //その他、閉じる
$(".month-archive-list", this).slideDown("fast"); //開く
$(".year").removeClass("acv_open"); //.acv_open削除
$(this).addClass("acv_open"); //.acv_open付加
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment