PageSourceSearch

https://www.gyosei-shiga.or.jp/wp-content/themes/2023_renewal/assets/js/main.js?ver=1790965933

js gyosei-shiga.or.jp collected 2026-10-02 18:32:26 UTC 4,556 bytes, 148 lines download raw bytes

1///--------------------------------------------------
2///
3///	読み込み時の共通動作
4///
5///--------------------------------------------------
6const $mobile = 769;
7const $tablet = 961;
8const $desktop = 1366;
9$(window).on('load resize', function(){
10	//ヘッダーリンクにアイコンを挿入
11	$.each($('#menu-item-1957, #menu-item-1958, #menu-item-1959, #menu-item-1939, #menu-item-1946').find('a'), function(){
12		if($(this).find('.icon').length == 0){
13			$(this).append('<span class="icon"><i class="icon-arrow"></i></span>');
14		}
15	});
16    //フッターリンクにアイコンを挿入
17	$.each($('#menu-item-1968, #menu-item-1969, #menu-item-1970, #menu-item-1973, #menu-item-1980').find('a'), function(){
18		if($(this).find('.icon').length == 0){
19			$(this).append('<span class="icon"><i class="icon-arrow"></i></span>');
20		}
21	});
22
23    //ウィンドウ幅判定
24	let win_width = window.innerWidth;
25
26	//ウィンドウの広さに合わせてbodyにclass設定
27	if(win_width <= $mobile){
28		if($('body').hasClass('view-sp')) return false;
29		$('body').addClass('view-sp').removeClass('view-tablet view-pc');
30		//f_menu_toggle()
31	}
32	else if(win_width <= $tablet){
33		if($('body').hasClass('view-tablet')) return false;
34		$('body').addClass('view-tablet').removeClass('view-sp view-pc');
35		$('.header_search').fadeOut(0);
36		//f_menu_toggle()
37	}
38	else{
39		if($('body').hasClass('view-pc')) return false;
40		$('body').addClass('view-pc').removeClass('view-sp view-tablet');
41		$('.header_nav').fadeOut(300);
42	}
43
44    // if(!$('body').hasClass('view-sp') && !$('body').hasClass('view-tablet')){
45    //     $('.menu-header-container').css('display','block');
46    // }
47	// else{
48	// 	$('.menu-header-container').css('display','none');
49	// }
50});
51
52///--------------------------------------------------
53///
54///	ハンバーガーメニューの動作
55///
56///--------------------------------------------------
57$(document).on('click', '.header_menu_btn', function(){
58    //if(!$('body').hasClass('view-sp') && !$('body').hasClass('view-tablet')) return false;
59	$(this).toggleClass('active');
60	$('body').toggleClass('open');
61	$('.menu-header-container').fadeToggle(300);
62	if($(this).hasClass('active')){
63		$(this).find('.header_menu_btn-txt').text('CLOSE');
64	}
65	else{
66		$(this).find('.header_menu_btn-txt').text('MENU');
67	}
68
69	return false;
70});
71
72///--------------------------------------------------
73///
74///	ヘッダーサブメニューの開閉処理
75///
76///--------------------------------------------------
77$(document).on('click', '.menu-header-wrap .menu-item a', function(){
78	if($(this).closest('.menu-item').hasClass('menu-item-has-children')){
79		if($(this).next('.sub-menu').length > 0){
80			if($(this).hasClass('active')){
81				$(this).removeClass('active');
82				$(this).next('.sub-menu').slideUp(300);
83			}
84			else{
85				$('.menu-header-wrap .menu-item a').removeClass('active');
86				$('.sub-menu').slideUp(300);
87
88				$(this).addClass('active');
89				$(this).next('.sub-menu').slideDown(300);
90			}
91		}
92	}
93});
94
95///--------------------------------------------------
96///
97///	フッターサブメニューの開閉処理
98///
99///--------------------------------------------------
100$(document).on('click', '.footer_navi-item .navi_link', function(){
101	if($(this).closest('.footer_navi-item').hasClass('has-children')){
102		if(!$('body').hasClass('view-sp') && !$('body').hasClass('view-tablet')) return false;
103		if($(this).next('.footer_subnavi-list').length > 0){
104			if($(this).hasClass('view')){
105				$(this).removeClass('view');
106				$(this).next('.footer_subnavi-list').slideUp(300);
107			}
108			else{
109				$('.footer_navi-item .navi_link').removeClass('view');
110				$('.footer_subnavi-list').slideUp(300);
111
112				$(this).addClass('view');
113				$(this).next('.footer_subnavi-list').slideDown(300);
114			}
115		}
116	}
117});
118
119///--------------------------------------------------
120///
121///	ページ内リンクの動作設定
122///
123///--------------------------------------------------
124$('a[href^="#"]:not(a[href="#"])').click(function(e){
125	e.preventDefault();
126	let speed = 2000;
127	let href = $(this).attr("href");
128	let target = $(href == "#" || href == "" ? 'html' : href);
129	let position = target.offset().top;
130	let numerical = 0;
131	if($('body').hasClass('view-sp')){
132		numerical = 100;
133	}
134	else if($('body').hasClass('view-tablet')){
135		numerical = 120;
136	}
137	else if($('body').hasClass('view-pc')){
138		numerical = 160;
139	}
140
141	$('html, body').stop().animate({
142		'scrollTop': (position - numerical)
143	}, speed, 'swing', function() {
144		//window.location.hash = target;
145	});
146
147	return false;
vendor: 3 bytes, line 148
148});

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.