PageSourceSearch

https://www.sbcr.jp/wp-content/themes/sbcr2019/resources/js/common.js?ver=322aa203

js sbcr.jp collected 2026-09-24 08:41:32 UTC 6,920 bytes, 252 lines download raw bytes

1jQuery(function($) {
2
3	$.fn.extend({ exists : function(fnc) { if(this[0]) { fnc($(this)); }}});
4
5	// header固定
6	function FixedAnime() {
7		var headerH = $('.header').outerHeight(true);
8		var scroll = $(window).scrollTop();
9		if (scroll >= headerH){//headerの高さ以上になったら
10				$('.header').addClass('fixed');//fixedというクラス名を付与
11			}else{//それ以外は
12				$('.header').removeClass('fixed');//fixedというクラス名を除去
13			}
14	}
15	// 画面をスクロールをしたら動かしたい場合の記述
16	$(window).on('scroll', function(event) {
17		FixedAnime();/* スクロール途中からヘッダーを出現させる関数を呼ぶ*/
18	});
19
20	//page-top
21	$('.totop').on('click', function(event) {
22		event.preventDefault();
23		$( 'html,body' ).animate( {scrollTop:0} , 'slow' ) ;
24	});
25
26	//ボタンのイベント
27	$(".menu-trigger").on('click', function(event) {
28		$(this).toggleClass("active");
29	});
30
31	//スライドメニュー
32	$(".header-lower .menu-item-has-children > a").on('click', function(event) {
33
34		if(isSp()) {
35			event.preventDefault();
36			event.stopPropagation();
37			$(this).closest('li').find(".sub-menu").slideToggle(300, 'swing', function() {
38				$(this).closest('li').toggleClass('is-open');
39				$(this).toggleClass('is-open').removeAttr('style');
40			});
41		}
42		// $(this).toggleClass("is-open");
43
44	});
45
46	//ドロワーメニュー
47	$(".menu-trigger").on('click', function(event) {
48		$(".header__in").toggleClass("is-open");
49	});
50
51	//フッターメニュー
52	$(".footer .f-upper ul.nav > li > a").on('click', function(event) {
53
54		if(isSp()) {
55			event.preventDefault();
56			$(this).toggleClass('is-open').next(".sub-menu").slideToggle(300, 'swing', function() {
57				$(this).toggleClass('is-open').removeAttr('style');
58			});
59		}
60	});
61
62	var $fromLi = $(".footer .f-upper ul.nav > li.menu-item-merge-from");
63	var $toLi = $(".footer .f-upper ul.nav > li.menu-item-merge-to");
64	if($fromLi.length > 0 && $toLi.length > 0) {
65		$toLi.append('<ul class="merge">'+$fromLi.prop('outerHTML')+'</ul>');
66	}
67
68	$('.f-banner-area ul').exists(function($elm) {
69		$elm.slick({
70			mobileFirst: true,
71			slidesToShow: 2,
72			slidesToScroll: 1,
73			autoplay: true,
74			dots: true,
75			arrows: false,
76			responsive: [{
77				breakpoint: 980,
78				settings: 'unslick'
79			}]
80		});
81
82		//リサイズした時に実行
83		$(window).on('resize orientationchange', function(event) {
84			$elm.slick('resize');
85		});
86	});
87
88	// モーダルウィンドウを開く
89	$('.js-modal-open').on('click', function(event){
90
91		event.preventDefault();
92		var target = $(this).data('target');
93		var modal = document.getElementById(target);
94		scrollPosition = $(window).scrollTop();
95
96		$('body').addClass('fixed').css({'top': -scrollPosition});
97		$(modal).fadeIn(200, 'swing');
98	});
99
100	// モーダルウィンドウを閉じる
101	$('.js-modal-close').on('click', function(event) {
102
103		event.preventDefault();
104		$('body').removeClass('fixed');
105		window.scrollTo( 0 , scrollPosition );
106		$('.js-modal').fadeOut(100, 'swing');
107	});
108
109	/* form
110	------------------------------------------------------------------- */
111	$('.form-box .text-red').exists(function($elm) {
112		$elm.each(function(){
113			$(this).parent('td').find('input,textarea').addClass('error');
114		});
115	});
116
117	/* ページャー
118	------------------------------------------------------------------- */
119	var $optionValue = [];
120	var $optionHtml = '<div class="option-list-warp">';
121	var $pageSelectBox = $('.page-select-box');
122	if ($pageSelectBox.length) {
123		var serach_word = location.search;
124		var pos = location.pathname.indexOf('page/');
125		if (pos < 0) {
126			var path = location.pathname;
127		} else {
128			var path = location.pathname.substring(0, pos);
129		}
130		if (isTouchDevice()) {
131			$pageSelectBox.append($optionHtml + '</div>');
132			//.labelクリックしたら
133			$(document).on('click', '.label', function() {
134				$('.option-list-warp').slideToggle();
135			});
136			//DOMクリックしたら
137			$(document).on('click', '.option-list-warp span', function() {
138				var url = $(this).data('link');
139				$('.label').text($(this).text())
140				$('.option-list-warp').slideToggle();
141				location.href = location.origin + path + url + serach_word;
142			});
143		} else {
144			//スマホ時
145			$pageSelectBox.find('select').css({ 'z-index': 1 })
146			//option切り替わったら
147			$pageSelectBox.on('change', function() {
148				var url = $(this).find('option:selected').val();
149				location.href = location.origin + path + url + serach_word;
150			})
151		}
152	}
153
154	//タッチデバイス判定 タッチじゃなかったらture
155	function isTouchDevice() {
156		result = true;
157		if (window.ontouchstart === null) {
158			var result = false;
159		}
160		return result;
161	}
162
163	// tabSwitcher
164	tabSwitcher.init();
165});
166
167/* tabSwitcher
168------------------------------------------------------------------- */
169var tabSwitcher = {
170
171	/* tabSwitcher.init()
172	------------------------------- */
173	init: function() {
174
175		jQuery('.list-tab__items.fade_switch li > a').exists(function($triggers) {
176
177			// click
178			$triggers.on('click', function(event) {
179				event.preventDefault();
180				event.stopPropagation();
181				tabSwitcher.switch(jQuery(this));
182			});
183
184			// init
185			$triggers.closest('.list-tab__items').exists(function($switchers) {
186				$switchers.each(function(index, el) {
187
188					// for calender
189					if(jQuery('body.calender').length > 0) {
190						var hash = location.hash;
191						if(hash !== '') {
192							var $selectItem = jQuery('.list-tab__items li a[href="'+hash+'"]');
193							if($selectItem.length > 0) {
194								$selectItem.trigger('click');
195								jQuery(window).scrollTop(0);
196								return;
197							}
198						}
199					}
200
201					if(jQuery(this).children('li.current').length === 0) {
202
203						var $firstItem = jQuery(this).children('li').eq(0);
204						if(!$firstItem.hasClass('current')) {
205							$firstItem.find('a').trigger('click');
206						}
207					}
208				});
209			});
210		});
211	},
212	/* tabSwitcher.switch()
213	------------------------------- */
214	switch: function($trigger) {
215
216		// tab
217		$trigger.closest('li').addClass('current').siblings('li').removeClass('current');
218
219		// content
220		jQuery($trigger.attr('href')).exists(function($target) {
221
222			$target.siblings('.area').removeClass('is-active');
223			$target.addClass('is-active');
224
225			// for slick
226			$target.find('.slick-initialized').exists(function($slider) {
227				$slider.slick('setPosition');
228			});
229
230			// for calender
231			// if(typeof calender !== 'undefined' && calender.wrap.length > 0) {
232			// 	calender.start();
233			// }
234		});
235	},
236};
237
238function isSp() {
239	var wH = jQuery(window).width();
240	if(wH <= 980) { return true; } return false;
241}
242function isPc() {
243	return !isSp();
244}
245function goScroll($target) {
246
247	var $header = jQuery('header');
248	var topPad = isPc() ? 30 : 15;
249	var toTop = $target.offset().top - $header.position().top - $header.outerHeight(true) - topPad;
250	// $('body,html').scrollTop(toTop);
251	jQuery('body,html').animate({scrollTop: toTop}, 300, 'swing');
252}

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.