PageSourceSearch

https://www.ayu.ne.jp/files/user/js/common.js?v=1790302632

js ayu.ne.jp collected 2026-10-02 07:15:56 UTC 3,952 bytes, 135 lines download raw bytes

1(function ($) {
2  // jQuery Easing プラグインが無い環境では標準イージングにフォールバック
3  var easing = function (name) {
4    return $.easing && $.easing[name] ? name : "swing";
5  };
6
7  var gnav = function () {
8    $("#gnav")
9      .find(".dropdown")
10      .on("mouseenter", function () {
11        $(this).find(".megaMenu").stop().slideDown(400, easing("easeOutQuint"));
12        $(this).find(".megaMenu").css({
13          "z-index": 999,
14          opacity: 1,
15        });
16        $(this).siblings().find(".megaMenu").css({
17          "z-index": 998,
18          opacity: 0,
19        });
20      })
21      .on("mouseleave", function () {
22        $(this).find(".megaMenu").stop().slideUp(400, easing("easeOutQuint"));
23      });
24  };
25
26  var tabSwitch = function (active_num) {
27    var $trigger = $(".tab-trigger"),
28      $target = $(".tab-target");
29    if (!$target.length) return;
30    $target.addClass("is_disable");
31    $target.eq(active_num).removeClass("is_disable");
32    $trigger.eq(active_num).addClass("is_active");
33    $trigger.on("click", function () {
34      var num = $(this).index(),
35        $active = $(".is_active"),
36        hideNum = $active.index();
37      $active.removeClass("is_active");
38      $trigger.eq(num).addClass("is_active");
39      $target.eq(hideNum).fadeOut(200, function () {
40        $(this).addClass("is_disable");
41        $target.eq(num).fadeIn(200, function () {
42          $(this).removeClass("is_disable");
43        });
44      });
45    });
46  };
47
48  var smoothScroll = function () {
49    $('a[href*="#"]').on("click", function () {
50      if (
51        location.pathname.replace(/^\//, "") !==
52          this.pathname.replace(/^\//, "") ||
53        location.hostname !== this.hostname
54      ) {
55        return;
56      }
57      var hash = this.hash;
58      var $target;
59      if (hash === "" || hash === "#") {
60        $target = $("html");
61      } else {
62        // ID に記号が含まれていてもセレクタ構文エラーにならないよう getElementById で取得
63        var el = document.getElementById(decodeURIComponent(hash.slice(1)));
64        if (!el) return;
65        $target = $(el);
66      }
67      if (!$target.length) return;
68      $("html,body").animate(
69        { scrollTop: $target.offset().top },
70        1000,
71        easing("easeOutExpo"),
72      );
73      return false;
74    });
75  };
76
77  var cta = function () {
78    var $cta = $("#cta");
79    var $foot = $("#footer");
80    if (!$cta.length || !$foot.length) return;
81
82    var footView = $foot.offset().top - 92;
83    var win_h = $(window).height();
84    if (footView < win_h) {
85      $cta.addClass("is_foot");
86    } else {
87      $cta.hide();
88      $(window).on("load scroll resize", function () {
89        var footTop = $foot.offset().top - $(window).height();
90        if ($(this).scrollTop() > 500) {
91          if ($(this).scrollTop() > footTop) {
92            $cta.addClass("is_foot");
93          } else {
94            $cta.removeClass("is_foot");
95            $cta.show().removeClass("fadeOutDown").addClass("fadeInUp");
96          }
97        } else {
98          if ($(this).scrollTop() > footView - $(window).height()) {
99            $cta.addClass("is_foot");
100            $cta.stop().removeClass("fadeOutDown").addClass("fadeInUp");
101          } else {
102            $cta.stop().removeClass("fadeInUp").addClass("fadeOutDown");
103          }
104        }
105      });
106    }
107  };
108
109  var carouselBnrs = function () {
110    var $bnrs = $(".carouselBnrs");
111    if (!$bnrs.length || !$.fn.bxSlider) return;
112    $bnrs.each(function () {
113      var sliderImg = $(this).find("li").length;
114      if (sliderImg > 4) {
115        $(this).bxSlider({
116          touchEnabled: false,
117          auto: true,
118          autoHover: true,
119          minSlides: 4,
120          maxSlides: 4,
121          slideWidth: 240,
122          slideMargin: 6,
123        });
124      }
125    });
126  };
127
128  $(function () {
129    gnav();
130    tabSwitch(0);
131    smoothScroll();
132    cta();
133    carouselBnrs();
134  });
135})(jQuery);

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.