PageSourceSearch

https://www.asakawa-shika.com/wp-content/themes/basic_tpl/js/common.js?v=4

js asakawa-shika.com collected 2026-10-04 15:23:51 UTC 10,878 bytes, 391 lines download raw bytes

1(function($) {
2	/* =====================================
3		header_scroll_toggle
4	===================================== */
5	var basePos = 0;
6	var defPos = basePos;
7
8	/*
9	$(window).on("load resize orientationchange", function () {
10		$('body').css("paddingTop", $('.l-header').outerHeight(true));
11	});
12	*/
13
14	$(window).on("load scroll orientationchange", function () {
15		var currentPos = $(window).scrollTop();
16
17		if(currentPos >= 150) {
18			$(".l-header").addClass("fixedBg");
19		} else {
20			$(".l-header").removeClass("fixedBg");
21		}
22
23		/*
24		if (currentPos >= defPos) {
25			if ($(window).scrollTop() >= 150) {
26				var hh = $(".l-header").outerHeight(true);
27				$(".l-header").css("top", "-" + hh + "px");
28			}
29			if($(window).width()<768) {
30				$(".sp-cv").css("bottom", 0 + "px");
31			}
32		} else {
33			$(".l-header").css("top", 0 + "px");
34			if($(window).width()<768 && (currentPos + $(window).height()) < $('.l-footer__copyright').offset().top) {
35				var fh = $(".sp-cv").outerHeight(true);
36				$(".sp-cv").css("bottom", "-" + fh + "px");
37			} else {
38				$(".sp-cv").css("bottom", 0 + "px");
39			}
40		}
41		*/
42
43		defPos = currentPos;
44
45	});
46
47
48	/* =====================================
49		PAGE TOP
50	===================================== */
51	$('.pagetop, .pagetops').on("click", function(){
52		$('html, body').animate({
53			scrollTop: 0
54		});
55	});
56	var timeoutPagetop;
57	$(window).on("scroll", function(){
58		$('.pagetop, .c-cnv__white-essence').addClass("scrollOn");
59		$('.l-footer__infoLinks').fadeOut();
60		clearTimeout(timeoutPagetop);
61		timeoutPagetop = setTimeout(function(){
62			$('.pagetop, .c-cnv__white-essence').removeClass("scrollOn");
63		}, 500);
64	});
65
66
67	/* =====================================
68		グローバルナビ
69	===================================== */
70	/*--------------------------------------
71		ハンガーメニュー
72	--------------------------------------*/
73	var ww = document.body.clientWidth;
74	/* 親メニュークラス付与 */
75	$('.c-gnav .menu>li>a:not([href]), .c-gnav .menu>li>a[href="#"]').each(function () {
76		$(this).addClass("parent");
77	});
78	/* イニシャルイベント */
79	adjustMenu(ww);
80	/* リサイズイベント */
81	$(window).on('resize orientationchange', function () {
82		ww = window.innerWidth;
83		adjustMenu(ww);
84	});
85	/* クリックイベント */
86	$(".toggleMenu").on("click", function (e) {
87		e.preventDefault();
88		$(this).toggleClass("active");
89		$(".c-gnav").fadeToggle();
90		$("body").toggleClass('fixed');
91	});
92
93	/* -------------------------------------
94		iPhoneで画面を戻った際にメニューが残る現象を回避
95	------------------------------------- */
96	$('.l-header .c-gnav .sub-menu li a[href*="#"]').click(function(){
97		if($(window).width() < 768) {
98			$(".toggleMenu").removeClass("active");
99			$("body").removeClass('fixed');
100			$(".l-header .c-gnav").fadeOut("500"); 
101		}
102	});
103
104	/* -------------------------------------
105		スマホグローバルナビ関数
106	------------------------------------- */
107	function adjustMenu(ww) {
108		if (ww <= 767) { //767以下=スマホ
109			if (!$(".toggleMenu").hasClass("active")) {
110				$(".c-gnav").hide();
111				$("body").removeClass('fixed');
112			} else {
113				$(".c-gnav").show();
114				$("body").addClass('fixed');
115			}
116			$(".c-gnav .menu>li").unbind('mouseenter mouseleave');
117			$(".c-gnav .parent").unbind("click");
118			$(".c-gnav .parent").click(function (e) {
119				e.preventDefault();
120				$(this).parent("li").toggleClass('hover');
121			});
122		} else { //768以上=PC,タブレット
123			$(".c-gnav").removeAttr("style");
124		}
125	}
126
127
128	/* =====================================
129		MAX HEIGHT
130	===================================== */
131	if($(".maxH")[0]) {
132		resizeH(".maxH");
133		$(window).bind("orientationchange resize",function(){
134				resizeH(".maxH");
135		});
136	}
137	function resizeH(eleH) {
138		if($(window).width()>767) {
139			$(eleH).find(".hTit").css("height","");
140			$(eleH).find(".hBody").css("height","");
141			$(eleH).each(function(){
142				var maxH = 0;
143				var maxH2 = 0;
144				$(this).find(".hTit").each(function(){
145					hTit = $(this).outerHeight();
146					if(maxH2<hTit) {
147						maxH2 = hTit;
148					}
149				});
150				$(this).find(".hTit").outerHeight(maxH2);
151				$(this).find(".hBody").each(function(){
152					hBody = $(this).outerHeight();
153					if(maxH<hBody) {
154						maxH = hBody;
155					}
156				});
157				$(this).find(".hBody").outerHeight(maxH);
158			});
159		} else {
160			$(eleH).find(".hTit").css("height","");
161			$(eleH).find(".hBody").css("height","");
162		}
163	}
164
165
166	/* =====================================
167		LOOP SLIDER
168	===================================== */
169	/*
170	loopSlider();
171
172	function loopSlider() {
173		$('.loopslider').each(function () {
174			var loopsliderWidth = $(this).width();
175			var loopsliderHeight = $(this).height();
176			$(this).children('ul').wrapAll('<div class="loopslider_wrap"></div>');
177			var listWidth = $('.loopslider_wrap').children('ul').children('li').width();
178			var listCount = $('.loopslider_wrap').children('ul').children('li').length;
179			var loopWidth = (listWidth) * (listCount);
180			$('.loopslider_wrap').css({
181				top: '0',
182				left: '0',
183				width: ((loopWidth) * 2),
184				height: (loopsliderHeight),
185				overflow: 'hidden',
186				position: 'absolute'
187			});
188			$('.loopslider_wrap ul').css({
189				width: (loopWidth)
190			});
191			loopsliderPosition();
192			function loopsliderPosition() {
193				$('.loopslider_wrap').css({
194					left: '0'
195				});
196				$('.loopslider_wrap').stop().animate({
197					left: '-' + (loopWidth) + 'px'
198				}, 55000, 'linear');
199				setTimeout(function () {
200					loopsliderPosition();
201				}, 55000);
202			};
203			$('.loopslider_wrap ul').clone().appendTo('.loopslider_wrap');
204		});
205	}
206
207	function loopSlider2() {
208		$('.loopslider2').each(function () {
209			var loopsliderWidth = $(this).width();
210			var loopsliderHeight = $(this).height();
211			$(this).children('ul').wrapAll('<div class="loopslider_wrap2"></div>');
212			var listWidth = $('.loopslider_wrap2').children('ul').children('li').width();
213			var listCount = $('.loopslider_wrap2').children('ul').children('li').length;
214			var loopWidth = (listWidth) * (listCount);
215			$('.loopslider_wrap2').css({
216				top: '0',
217				right: '0',
218				width: ((loopWidth) * 2),
219				height: (loopsliderHeight),
220				overflow: 'hidden',
221				position: 'absolute'
222			});
223			$('.loopslider_wrap2 ul').css({
224				width: (loopWidth)
225			});
226			loopsliderPosition();
227			function loopsliderPosition() {
228				$('.loopslider_wrap2').css({
229					right: '0'
230				});
231				$('.loopslider_wrap2').stop().animate({
232					right: '-' + (loopWidth) + 'px'
233				}, 55000, 'linear');
234				setTimeout(function () {
235					loopsliderPosition();
236				}, 55000);
237			};
238			$('.loopslider_wrap2 ul').clone().appendTo('.loopslider_wrap2');
239		});
240	}
241	*/
242
243
244	/* =====================================
245		TOP SLIDER
246	===================================== */
247	/*
248	var slideChangeFlg = 'pc';
249	$(window).on("load resize orientationchange", function() {
250		topSliderChange();
251	});
252	function topSliderChange() {
253		if($(window).width() < 768) {
254			if(slideChangeFlg == 'pc') {
255				$('.swiper-slide-image').each(function() {
256					$(this).attr('src', $(this).attr('src').replace('.jpg', '-sp.jpg'));
257				});
258				slideChangeFlg = 'sp';
259			}
260		} else {
261			if(slideChangeFlg == 'sp') {
262				$('.swiper-slide-image').each(function() {
263					$(this).attr('src', $(this).attr('src').replace('-sp', ''));
264				});
265				slideChangeFlg = 'pc';
266			}
267		}
268	}
269	*/
270
271
272	/* =====================================
273		スクロールヒント
274	===================================== */
275	if($('.table-scroll')[0]) {
276		function scrollTableHint() {
277			$(".table-scroll-wrap").removeAttr("style");
278			$(".table-scroll-wrap").each(function() {
279				var tableWidth = $(this).width();
280				$(this).css({"width":tableWidth,"white-space":"nowrap"});
281			});
282		}
283		$.getScript("/wp-content/themes/basic_tpl/js/scroll-hint.min.js", function(){
284			new ScrollHint('.table-scroll', {
285				// remainingTime: 10000
286			});
287		});
288		$('body').append('<link rel="stylesheet" href="/wp-content/themes/basic_tpl/css/scroll-hint.css">');
289		$(window).on("resize orientatoinchange", function(){
290			scrollTableHint();
291		});
292		scrollTableHint();
293	}
294
295	
296	/* =====================================
297							accordion
298	===================================== */
299	jQuery(function($) {
300		$('.accordion p').click(function(){
301			if($(this).next('ul').is(':visible')) {
302				$(this).next('ul').slideUp(300);
303				$(this).removeClass('acv_open');
304			} else {
305				$('.accordion ul').slideUp();
306				$('.accordion').find('p').removeClass('acv_open');
307				$(this).next('ul').slideDown(300);
308				$(this).addClass('acv_open');
309			}
310		});
311	});
312
313
314	/* =====================================
315		CUSTOM SWIPER
316	===================================== */
317	if($('.swiper_custom')[0]) {
318		var swiperMain = new Swiper('.swiper-container', {
319			speed: 600,
320			loop: true,
321			autoplay: {
322				delay: 3000,
323				pauseOnMouseEnter: true
324			},
325			navigation: {
326				nextEl: '.swiper-button-next',
327				prevEl: '.swiper-button-prev',
328			},
329		});
330	
331		function slideThumb(index) {
332			swiperMain.slideTo(index);
333		}
334		$('.thumb-list>li').on("click", function() {
335			var idx = $('.thumb-list>li').index(this) + 1;
336			console.log(idx);
337			slideThumb(idx);
338		});
339	}
340
341
342	/* =====================================
343		リンクインデックスのアンカーリンク自動割振
344	===================================== */
345	if($('.c-link-indexes')[0]) {
346		if($('.main h2.elementor-heading-title')[0]) {
347			$('.c-link-indexes').append('<ul class="link_indexes">');
348			$('.main h2.elementor-heading-title').each(function(i) {
349				var indexTxt = $(this).text();
350				$(this).attr('id', 'a' + (i + 1));
351				$('.c-link-indexes .link_indexes').append(`<li><a href="#a${i + 1}"><span>${indexTxt}</span></a></li>`);
352			});
353		} else {
354			$('.c-link-indexes').remove();
355		}
356	}
357
358
359	/* =====================================
360		固定フッターの『予約・お問い合わせ』バナ表示・非表示
361	===================================== */
362	$('.l-footer__infoBox img').on("click", function() {
363		$(this).parent().find('.l-footer__infoLinks').fadeToggle();
364	});
365
366
367	/* =====================================
368		固定フッターの『予約・お問い合わせ』バナ表示・非表示
369	===================================== */
370	$('.cosume_menu_hover').hover(
371		function(e) {
372			const idx = $(this).index();
373			$(`.cosume_link_clip0${idx}`).css({"background-color":"rgba(128, 102, 72, .2)"});
374		},
375		function(e) {
376			const idx = $(this).index();
377			$(`.cosume_link_clip0${idx}`).attr("style", "");
378		}
379	);
380	$('.cosume_link_clip01, .cosume_link_clip02, .cosume_link_clip03, .cosume_link_clip04, .cosume_link_clip05, .cosume_link_clip06').hover(
381		function(e) {
382			const idx = $(this).index();
383			$('.cosume_menu_hover').eq(idx - 1).css({"background-color":"rgba(128, 102, 72, .1)"});
384		},
385		function(e) {
386			const idx = $(this).index();
387			$('.cosume_menu_hover').eq(idx - 1).attr("style", "");
388		}
389	);
390
391})(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.