PageSourceSearch

https://tcb-agaskin.com/wp-content/themes/keni8-child/js/common.js

js tcb-agaskin.com collected 2026-10-05 05:39:36 UTC 7,059 bytes, 267 lines download raw bytes

1var ua = navigator.userAgent
2
3// タブレット端末かどうか
4var sp = (ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0)
5var tab = (!sp && (ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0))
6
7// タブレット端末でのみ、PC向けデザインの最小幅を、viewportの最小幅に設定
8if (tab) new ViewportExtra(1280)
9
10
11jQuery(function() {
12
13	// SP navigation
14	$('#menu-trigger').click(function(){
15		if($('#menu').hasClass('opened')){
16			$('#menu').removeClass('opened');
17			$('#menu-trigger').removeClass('active');
18		}else{
19			$('#menu').addClass('opened');
20			$('#menu-trigger').addClass('active');
21		}
22	});
23
24	// SP tel-list
25	$('#open_tel-area').click(function(){
26		$('#tel-area').fadeIn();
27		$('#tel-area').addClass('opened');
28	});
29	$('#close_tel-area').click(function(){
30		$('#tel-area').fadeOut();
31		$('#tel-area').removeClass('opened');
32	});
33	
34});
35
36
37
38
39/* BUTTON MENU SP */
40
41$(document).ready(function () {
42	"use strict";
43	// BACK TO TOP
44	$(window).scroll(function () {
45		if ($(this).scrollTop() > 0) {
46			$('#btn_top').fadeIn(300);
47		}
48		else{
49			$('#btn_top').fadeOut(300);
50		}
51	});
52
53	$('#btn_top').click(function () {
54		$('body,html').animate({
55			scrollTop: 0
56		}, 800);
57	});
58
59	//anchor
60	$('a[href*="#"]').on("click",function(){
61		console.log('test');
62		var windowWidth = $(window).width();
63		var windowSm = 680; // スマホに切り替わる横幅
64		if (windowWidth <= windowSm) {
65			var headerHeight = 100; // スマホのヘッダー等の高さ分の数値を入れる
66		} else {
67			var headerHeight = 200; // PC のヘッダー等の高さ分の数値を入れる
68		}
69		var url = $(location).attr('href');
70		setTimeout(function(){
71			if(url.indexOf("?id=") !== -1){
72				var speed = 1000;
73				var id = url.split("?id=");
74				var $target = $('#' + id[id.length - 1]);
75				if($target.length){
76					var pos = $target.offset().top-headerHeight;
77					$("html, body").animate({scrollTop:pos}, speed, "swing");
78				}
79			}
80		},1000);
81	});
82
83	var num = $('.toc_list li:last-child .toc_number').html();
84	var num = parseInt(num) + 1;
85	$('.single_opinfo .toc_list li:last-child').after('<li><a href="#price"><span class="toc_number toc_depth_1">' + num +  '</span> 料金表</a></li>');
86
87	// HOVER GNAVI
88	if ($(window).width() > 640) {
89		$('#gnavi .menu-item-27, #gnavi .menu-item-25').mouseenter(function(){
90			$(this).find('.sub-menu').stop().addClass('active');
91		});
92
93		$('#gnavi .menu-item-27, #gnavi .menu-item-25').mouseleave(function(){
94			$('.sub-menu').stop().removeClass('active');
95		});
96	} else{
97		$('#gnavi .menu-item-27 a, #gnavi .menu-item-25 a').click(function(){
98			$('.sub-menu').slideUp();
99			$(this).next('.sub-menu').stop().slideToggle();
100		});
101	}
102
103	// GNAVI SCROLL
104	if ($(window).width() > 640) {
105        // PC
106		var h_head = $('#header').outerHeight();
107		var local = $('#header').offset().top + 400;
108		var local_on = $('#header').offset().top + 550;
109
110		$(window).scroll(function () {
111			if ($(this).scrollTop() > local) {
112				$('#header').addClass('fixed');
113				$('#wrapper').css({'padding-top' : h_head});
114			}
115			else{
116				$('#header').removeClass('fixed');
117				$('#wrapper').css({'padding-top' : 0});
118			}
119		});
120
121		$(window).scroll(function () {
122			if($(this).scrollTop() > local_on){
123				$('#header').addClass('active');
124			}
125			else{
126				$('#header').removeClass('active');
127			}
128		});
129	}
130
131	else{
132        // SP
133		$('#foot_link .link_item p').click(function(){
134			$('#foot_link .link_item ul').slideUp();
135			$(this).next('ul').stop().slideToggle();
136		});
137
138		$('.nav_btn').click(function(){
139			$(this).stop().toggleClass('active');
140			$('.sub_form').slideUp();
141			$('#gnavi').stop().toggleClass('active');
142			$('.nav2_btn').stop().removeClass('active');
143			$('#gnavi_sp').stop().removeClass('active');
144		});
145
146		$('.nav2_btn, .nav2_btn_trigger').click(function(){
147			$(this).stop().toggleClass('active');
148			$('.cancell').stop().toggleClass('active');
149			$('.nav_btn').stop().removeClass('active');
150			$('.sub_form').slideUp();
151			$('#gnavi').stop().removeClass('active');
152			$('#gnavi_sp').stop().toggleClass('active');
153		});
154
155		$('.cancell').click(function(){
156			$(this).stop().toggleClass('active');
157			$('#gnavi_sp').stop().removeClass('active');
158		});
159
160/*
161        // ????????????? ON
162        $(window).on('scroll.switchHeaderIcon', function(){
163            let target = $('#logo');
164            if ( $(this).scrollTop() > 100 ) {
165                target.addClass('scrolled');
166            } else {
167                target.removeClass('scrolled');
168            }
169        });
170*/
171
172	}
173
174	if(navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/)){
175		$('.sp_href_delete').each(function(){
176			$(this).removeAttr('href');
177		});
178	}
179
180	var $win = $(window);
181	var windowWidth = window.innerWidth;
182	$win.on('load', function() {
183		if (windowWidth < 760) {
184			$(".dl-ac dt").on("click", function() {
185				$(this).next('').slideToggle();
186			});
187		}
188		else {
189			map_delay();	// google map 遅延読み込み
190		}
191	});
192	
193	$win.on('resize', function() {
194		windowWidth = window.innerWidth;
195		if( 760 <= windowWidth ){
196			$(".dl-ac dd").css("display", "");
197		}
198		else {
199			map_delay();	// google map 遅延読み込み
200		}
201	});
202	
203	/*$win.on('resize', function() {
204		if (windowWidth == window.innerWidth) {
205			return;
206		}
207		windowWidth = window.innerWidth;
208		if (windowWidth < 760) {
209			$(".dl-ac dt").on("click", function() {
210				$(this).next('').slideToggle();
211			});
212		} else if( 760 <= windowWidth ){
213			$(".dl-ac dd").css("display", "");
214		}
215	});*/
216
217
218
219
220	if ($(".hl").length > 0) {
221		$(".hl").heightLine();
222	}
223	if ($(".qa_opinfo_category_post li a").length > 0) {
224		$(".qa_opinfo_category_post li a").heightLine();
225	}
226
227
228
229	// CLICK LINK ANCHOR
230	$("#box07 .box07_img").click(function(){
231		if($(this).find("a").attr("target")=="_blank"){
232			window.open($(this).find("a").attr("href"), '_blank');
233		}else{
234			window.location=$(this).find("a").attr("href");
235		}
236		return false;
237	});	
238
239
240    
241    // tabs
242    $('.box_index_tab li').click(function(){
243        let genre = $(this).data('genre');
244        // コンテンツ切り替え
245        $('.box_index_list').hide( 0, function(){
246            $('.box_index_list[data-genre="' + genre + '"]').show();
247        });
248        // クラス制御
249        $('.box_index_tab li').removeClass('box_index_tab_active');
250        $(this).addClass('box_index_tab_active');
251    });
252
253});
254
255
256// ==========================================================
257// google map 遅延読み込み
258// PCは埋め込み表示、SPはGoogleMapのダイレクトリンクのみ
259// ==========================================================
260function map_delay() {
261	if ($('.map_delay').length ) {
262		$(".map_delay").each(function(){
263			var map_url = $(this).data("url");
264			$(this).find('iframe').attr('src',map_url);
265		});
266	}
267}

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.