PageSourceSearch

https://img.hoshikare.jp/api/assets/loader/1/assets/profile/js/common.js

js hoshikare.jp collected 2026-10-02 15:30:30 UTC 4,912 bytes, 203 lines download raw bytes

1////////////////////////////////////
2//  Header Menu
3////////////////////////////////////
4
5function header(){
6	$(document).on('click', '.js-hamburger,.js-menu__btn', function(){
7	  if($('.js-hamburger').hasClass('is-active')) {
8	  	$('.js-hamburger').removeClass("is-active");
9	  	$('body').removeClass("is-active");
10	  	$(".js-menu").removeClass("is-active");
11	  	$(".js-menu").fadeOut(200);
12	  } else {
13	  	$('.js-hamburger').addClass("is-active");
14	  	$('body').addClass("is-active");
15	  	$(".js-menu").addClass("is-active");
16	  	$(".js-menu").fadeIn(200);
17	  }
18	});
19	$(document).on('click', '.js-close', function(){
20	  $('body').removeClass("is-active");
21	  $(".js-hamburger").removeClass("is-active");
22	  $(".js-menu").removeClass("is-active");
23	  $(".js-menu").fadeOut(200);
24	});
25}
26
27function headerPadding(){
28	var headerAttr = $(".l-header").attr('type');
29	var headerHeight = $('header').innerHeight();
30	if (headerAttr != 'none') {
31		$('#container').css('padding-top', headerHeight - 1);
32	}
33}
34
35$(function(){
36    header();
37    headerPadding();
38});
39
40////////////////////////////////////
41//  Smooth Scroll
42////////////////////////////////////
43  
44  function scroll(){
45      $('a[href^="#"]').click(function(){
46        var adjust = 0;
47        var speed = 400;
48        var href= $(this).attr("href");
49        var target = $(href == "#" || href == "" ? 'html' : href);
50        var position = target.offset().top + adjust;
51        $('body,html').animate({scrollTop:position}, speed, 'swing');
52        return false;
53      });
54  }
55
56  $(function(){
57      scroll();
58  });
59
60////////////////////////////////////
61//  Tab
62////////////////////////////////////
63  
64  function tab(){
65    $('.js-tab__nav p').click(function() {
66        var target = $(this).parents('.js-tab__nav').attr('target');
67        var index = $(this).index();
68        $(this).parents('.js-tab__nav').find('p').removeClass('is-active');
69        $(target).find('.p-tab__item').removeClass('is-active');
70        $(this).addClass('is-active');
71        $(target).find('.p-tab__item').eq(index).addClass('is-active');
72    });
73  }
74
75  $(function(){
76      tab();
77  });
78
79////////////////////////////////////
80//  Load Fade
81////////////////////////////////////
82
83function load_effect() {
84  var element = document.getElementsByClassName('load-fade');
85  if(!element) return; // 要素がない場合は終了
86  
87  for(var i = 0; i < element.length; i++) { 
88    element[i].classList.add('is-show');
89  }
90}
91setTimeout(load_effect, 600); // 600ミリ秒経過後に実行
92
93////////////////////////////////////
94//  Page Top
95////////////////////////////////////
96
97function pageTop(){
98	const pageTop = $(".js-page__top");
99	pageTop.hide();
100	$(window).scroll(function () {
101	  if ($(this).scrollTop() > 100) {
102	    pageTop.fadeIn();
103	  } else {
104	    pageTop.fadeOut();
105	  }
106	});
107	pageTop.click(function () {
108	  $("body,html").animate(
109	    {
110	      scrollTop: 0,
111	    },
112	    500
113	  );
114	  return false;
115	});
116	// フッター手前でストップ
117	$(".js-page__top").hide();
118	$(window).on("scroll", function () {
119	  scrollHeight = $(document).height();
120	  scrollPosition = $(window).height() + $(window).scrollTop();
121	  footHeight = $("footer").innerHeight();
122	  if (scrollHeight - scrollPosition <= footHeight) {
123	    $(".js-page__top").css({
124	      position: "absolute",
125	      bottom: footHeight + 10,
126	    });
127	  } else {
128	    $(".js-page__top").css({
129	      position: "fixed",
130	      bottom: "20",
131	    });
132	  }
133	});
134}
135
136$(function(){
137    pageTop();
138});
139
140////////////////////////////////////
141//  Modal
142////////////////////////////////////
143  
144function modal(){
145    $(document).on('click', '.js-modal', function () {
146        var target = $(this).attr('modal-id');
147        $('#'+target).stop().fadeIn();
148    });
149    $(document).on('click', '.js-modal__close', function () {
150        $('.l-modal').stop().fadeOut();
151    });
152}
153
154$(function(){
155    modal();
156});
157
158////////////////////////////////////
159//  Single Page
160////////////////////////////////////
161  
162  function singlePage(){
163    const setFillHeight = () => {
164      const vh = window.innerHeight * 0.01;
165      document.documentElement.style.setProperty('--vh', `${vh}px`);
166    }
167
168    let vw = window.innerWidth;
169
170    window.addEventListener('resize', () => {
171      if (vw === window.innerWidth) {
172       // 画面の横幅にサイズ変動がないので処理を終える
173        return;
174      }
175
176      // 画面の横幅のサイズ変動があった時のみ高さを再計算する
177      vw = window.innerWidth;
178      setFillHeight();
179    });
180
181    // 初期化
182    setFillHeight();
183  }
184
185  $(function(){
186      singlePage();
187  });
188
189////////////////////////////////////
190//  Accordion
191////////////////////////////////////
192  
193function accordion(){
194    $(document).on('click', '.js-accordion', function () {
195    	$(this).toggleClass('is-active');
196    	$(this).next().slideToggle();
197    });
198}
199
200$(function(){
201    accordion();
202});
203

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.