PageSourceSearch

https://www.yamagata-cci.or.jp/resources/js/custom.js

js yamagata-cci.or.jp collected 2026-10-02 07:47:05 UTC 4,607 bytes, 201 lines download raw bytes

1
2$(function(){
3
4//ヘッダ内追加要素
5
6$('.header_title').append('<p class="bosyu_btn"><a href="/user/join/">新規会員募集中!</a></p>','<p class="sns_icon"><a href="https://page.line.me/xiz5393i?openQrModal=true" target="_blank" class="sns_line">公式LINE</a></p>');
7
8
9//ページトップへ戻るボタン
10
11	//画面幅取得
12	getScreenWidth();
13
14	var pagetop = $('.btn_pagetop');
15
16	$(window).on('scroll resize', function() {
17		if(screenWidth >= 788){
18			if ($(this).scrollTop() > 100) {
19				pagetop.stop().fadeIn(200);
20			} else {
21				pagetop.stop().fadeOut(200);
22			}
23		} else {
24			pagetop.show();
25		}
26	});
27
28
29
30//スムーズスクロール
31
32	$('a[href^="#"], area[href^="#"]').click(function() {
33		var speed = 1000;
34		var href= $(this).attr("href");
35		var target = $(href == "#" || href == "" ? 'html' : href);
36		var headerHeight = $('#main_menu_box').outerHeight() + 10;
37		var position = target.offset().top - headerHeight;
38		$('body,html').stop().animate({scrollTop:position}, speed, 'easeOutQuart');
39//		return false;
40	});
41
42
43
44//box全体のリンク領域設定
45//適用したいblock要素に「.clickable-box」を設定(注:内包するaタグは1個のみ)
46
47//	$('.clickable-box').on('click', function(){
48	$(document).on('click', '.clickable-box', function(){
49		if($(this).find("a").length == 0){
50			return false;
51		} else if($(this).find("a").attr("target")=="_blank"){
52			window.open($(this).find("a").attr("href"), '_blank');
53		} else {
54			window.location=$(this).find("a").attr("href");
55		}
56		return false;
57	});
58
59//	$('.clickable-box').hover(function(){
60	$(document).on('mouseenter', '.clickable-box', function(){
61		if($(this).find("a").length == 0){
62			return false;
63		} else {
64			$(this).css('cursor','pointer');
65		}
66		return false;
67	});
68
69
70
71//電話番号リンク("tel:***")をスマートフォン端末以外では無効にする
72
73	var ua = navigator.userAgent.toLowerCase();
74	var isMobile = /iphone/.test(ua)||/android(.+)?mobile/.test(ua);
75
76	if (!isMobile) {
77		$('a[href^="tel:"]').on('click', function(e) {
78			e.preventDefault();
79		});
80	}
81
82
83
84
85
86});
87
88
89
90// -----------------------------------------------------------------------------------------------
91
92
93
94//アンカーメニューの開閉
95
96$(window).on('load resize', function(){
97	if (window.innerWidth >= 788 ){
98		$('.anchor_menu').css('display', 'flex');
99	} else {
100		if ($('.anchor_menu_btn').hasClass('open')){
101			$('.anchor_menu').css('display', 'block');
102		} else {
103			$('.anchor_menu').css('display', 'none');
104		}
105	}
106});
107
108$(function(){
109	$('.anchor_menu_btn').on('click', function(){
110		$('.anchor_menu_btn').toggleClass('open');
111		$('.anchor_menu').stop().slideToggle();
112	});
113});
114
115
116
117
118//FancyBoxカーソル
119
120$(document).ready(function() {
121	$('[data-fancybox]').css('cursor','zoom-in');
122});
123
124
125
126
127//ページ遷移時のアンカーリンクの位置調整
128
129$(window).on('load', function() {
130	var url = $(location).attr('href');
131	var headerHeight = $('#main_menu_box').outerHeight() + 10;
132	setTimeout(function(){
133		if(url.indexOf("#") != -1){
134			var anchor = url.split("#");
135			var target = $('#' + anchor[anchor.length - 1]);
136			if(target.length){
137				var position = target.offset().top - headerHeight;
138				$("html, body").animate({scrollTop:position}, 10, 'easeOutQuart');
139			}
140		}
141	},10);
142});
143
144
145
146//CTA Banner
147
148$(function(){
149	$(window).on('scroll', function() {
150
151		const distance = $(this).scrollTop();
152		const scrollTop = 50;
153		const scrollHeight = $(document).height();
154		const scrollPosition = $(window).height() + $(window).scrollTop();
155//			const footHeight = $('footer').height() - 150;
156
157//			if ( distance > scrollTop && scrollHeight - scrollPosition  > footHeight ) {
158		if ( distance > scrollTop ) {
159			$('#floatbanner').addClass('active');
160		} else {
161			$('#floatbanner').removeClass('active');
162		}
163	});
164});
165
166
167
168
169
170//Footer Fix用
171
172	$(window).on('load resize', function(){
173		//画面幅取得
174		getScreenWidth();
175		var footerHeight = $('footer').outerHeight();
176		var footerPadding;
177
178		if ( screenWidth >= 788 ){
179			footerPadding = footerHeight - 20;
180			$('#contents_box').css('padding-bottom',footerPadding);
181		} else {
182			footerPadding = footerHeight + 60;
183			$('#contents_box').css('padding-bottom',footerPadding);
184		}
185	});
186
187
188
189
190//window innerWidth取得(safari対応)
191
192function getScreenWidth(){
193	var userAgent = window.navigator.userAgent.toLowerCase();
194	if (userAgent.indexOf('safari') !== -1 && userAgent.indexOf('chrome') === -1 && userAgent.indexOf('edge') === -1){
195		screenWidth = document.documentElement.clientWidth;		// for Safari
196	} else {
197		screenWidth = window.innerWidth;
198	}
199}
200
201

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.