PageSourceSearch

https://revive-support.jp/wp/wp-content/themes/revive-support/js/accordion.js

js revive-support.jp collected 2026-10-04 19:20:02 UTC 2,783 bytes, 84 lines download raw bytes

1jQuery(function ($) {
2    $("#acMenu dt").on("click", function () {
3        $(this).next().slideToggle();
4        // activeが存在する場合
5        if ($(this).hasClass('active')) {
6            // activeを削除
7            $(this).removeClass('active');
8
9        } else {
10            // activeを追加
11            $(this).addClass('active');
12        }
13    });
14});
15
16jQuery(function ($) {
17
18    var itemHeights = [];
19    var returnHeight;
20    var lastWidth = window.innerWidth;
21
22    $(".accordion-text").each(function () {
23        // 隠す要素
24        var thisHeight = $(this).height(); // 隠す要素の高さを取得
25        itemHeights.push(thisHeight); // それぞれの高さを配列に入れる
26        $(this).addClass("is-hide"); // CSSで指定した高さにする(見えてる高さ)
27        returnHeight = $(this).height(); // 見えてる高さを取得
28    });
29
30    function SP_rotate() {
31        if (lastWidth != window.innerWidth) {
32            lastWidth = window.innerWidth;
33            itemHeights = [];
34            $(".accordion-text").each(function () {
35                $(this).removeClass("is-hide");
36                $(this).prev().addClass('is-show');
37                $(this).css('height', 'auto');
38                itemHeights.push($(this).height());
39            });
40            $('section.guideline .overlay').removeClass('close');
41        }
42    }
43    window.addEventListener('resize', SP_rotate);
44
45    $(".accordion-btn").click(function () {
46        // ボタンをクリックしたら
47        if (!$(this).hasClass("is-show")) {
48            const index = $(this).index(".accordion-btn");
49            const addHeight = itemHeights[index]; // 要素の高さを取得
50            $(this)
51                .addClass("is-show") // 閉じるボタンに表示変更
52                .next()
53                .animate({
54                    height: addHeight
55                }, 300, function () {
56                    var top = $(this).offset().top;
57                    $('html,body').animate({
58                        scrollTop: top
59                    }, 500);
60                });
61        } else {
62            $(this)
63                .removeClass("is-show") // 閉じるボタン表示解除
64                .next()
65                .animate({
66                    height: returnHeight
67                }, 300, function () {
68                    var top = $(this).offset().top;
69                    $('html,body').animate({
70                        scrollTop: top
71                    }, 500);
72                });
73        }
74
75        let num = $('.accordion .is-show').length;
76        let bg = $('section.guideline .overlay');
77        if (num == 0) {
78            bg.addClass('close');
79        } else {
80            bg.removeClass('close');
81        }
82
83    });
84});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.