PageSourceSearch

https://accommon.jp/js/script.js

js accommon.jp collected 2026-10-02 00:12:02 UTC 4,986 bytes, 189 lines download raw bytes

1/* ===================================================================
2
3 * PC向けメニュー
4
5// =================================================================== */
6// $(function($) {
7// 	// 読み込み時処理
8// 	navFix();
9// 	// スクロール時処理
10// 	$(window).on('scroll', function() {
11// 		navFix();
12// 	});
13
14// 	// ナビゲーション固定
15// 	function navFix() {
16// 		var headerH = $('header').outerHeight(true);
17// 		if ($(this).scrollTop() > headerH) {
18// 			$('nav').addClass('fixed');
19// 		} else {
20// 			$('nav').removeClass('fixed');
21// 		}
22// 	}
23// });
24
25
26/* ===================================================================
27
28 * PC/スマホ向けメニュー切り替え
29
30=================================================================== */
31$(function($){
32	var timer = false;
33	var windowWidth = window.innerWidth || document.documentElement.clientWidth || 0;
34	var nowWidth;
35
36	// 読み込み時処理
37	$(window).on('load', function(){
38		headerHight();
39		spMenu();
40		subNav();
41		summay();
42	});
43
44	// リサイズ時処理
45	$(window).on('resize', function(){
46		if (timer !== false) {
47			clearTimeout(timer);
48		}
49		timer = setTimeout(function() {
50			nowWidth = window.innerWidth || document.documentElement.clientWidth || 0;
51			if ( windowWidth != nowWidth ) {
52				headerHight();
53				subNav();
54				summay();
55				windowWidth = window.innerWidth || document.documentElement.clientWidth || 0;
56			}
57		}, 200);
58	});
59
60	// ヘッダー分の余白取得(スマートフォンのみ)
61	function headerHight() {
62		if ($('#spMenu').css('display') == 'block') {
63			var headerH = $('header').outerHeight(true);
64			$('body').css({'margin-top' : headerH});
65		}else {
66			$('body').css({'margin-top' : 0});
67		}
68	}
69
70	// メニューボタンの表示(
71	function spMenu() {
72		$('#spMenu').on('click', function(e) {
73			$('.gnav').slideToggle(e);
74			$('#navBtnIcon').toggleClass('close');
75			$('html, body').toggleClass('lock');
76		});
77	}
78
79	// サブメニューの表示
80	function subNav() {
81		if ($('#spMenu').css('display') == 'block') {
82			$('.subnav > a').off().on('click', function(e) {
83				e.preventDefault();
84				$(this).next('ul').slideToggle();
85				$(this).parent().toggleClass('active');
86			});
87		} else {
88			if('ontouchstart' in document) {
89				$('.subnav > a').off().on('click', function(e) {
90					e.preventDefault();
91				});
92			}
93		}
94	}
95
96	// 要約部分の非表示
97	function summay() {
98		if ($('#spMenu').css('display') == 'block') {
99			var position = 50; // 非表示位置
100			var $element = $('.summary');
101			if ($(window).scrollTop() > position){
102				$element.hide();
103			}
104			$(window).on('scroll', function(){
105				if ($(this).scrollTop() >= position) {
106					$element.not(':animated').hide();
107				} else {
108					$element.not(':animated').show();
109				}
110				headerHight();
111			});
112		}
113	}
114});
115
116/* ===================================================================
117
118 * ページ内リンク
119
120=================================================================== */
121$(function($){
122	var timer = false;
123	$(window).on('load', function(){
124		if (timer !== false) {
125			clearTimeout(timer);
126		}
127		timer = setTimeout(function() {
128			innerLink();
129			innerLinkMenu();
130		}, 300);
131	});
132
133	function innerLink() {
134		var easing = 'swing'; // 動作パターン
135		var speed = 500;      // スクロールの速度
136		var marginTop = 10;   // スクロール位置の変更
137
138		var url = $(location).attr('href');
139		if(url.indexOf('?id=') != -1){
140			var id = url.split('?id=');
141			var target = $('#' + id[id.length - 1]);
142			if(target.length){
143				// スマートフォン向け内部リンク
144				if($('#spMenu').css('display') == 'block') {
145					var fixEle = $('header');
146					var fixHeight = fixEle.outerHeight(true);
147					if($('.summary').css('display') == 'block') {
148						var position = target.offset().top- fixHeight -marginTop;
149					}
150				// PC向け内部リンク
151				} else {
152					var fixEle = $('nav');
153					var fixHeight = fixEle.outerHeight(true);
154					if($('nav').css('position') == 'fixed') {
155						var position = target.offset().top - fixHeight - marginTop;
156					} else {
157						var position = target.offset().top - fixHeight - fixHeight - marginTop;
158					}
159				}
160				$('html, body').animate({scrollTop:position}, speed, easing);
161			}
162		}
163	}
164
165	function innerLinkMenu() {
166		// メニューの表示・非表示
167		$('.gnav a[href^="#"]').on('click', function(e) {
168			if($('#spMenu').css('display') == 'block') {
169				$('.gnav').slideToggle(e);
170				$('#navBtnIcon').toggleClass('close');
171				$('html, body').toggleClass('lock');
172			}
173		});
174	}
175});
176/* ===================================================================
177
178 * スライドショー
179
180=================================================================== */
181$('.slide').slick({ //{}を入れる
182	autoplay: true, //「オプション名: 値」の形式で書く
183	dots: true, //複数書く場合は「,」でつなぐ
184	centerMode: true,
185	infinite: true,
186	speed: 300,
187	slidesToShow: 1,
188	slidesToScroll: 1,
189});

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.