PageSourceSearch

https://hyogo-maikopark.jp/_scripts/_common/base.js

js hyogo-maikopark.jp collected 2026-10-04 12:31:44 UTC 7,466 bytes, 262 lines download raw bytes

1/* base */
2(function ($) {
3
4	// タブレットをPCと同じ表示にする
5	$(function(){
6		var ua = navigator.userAgent;
7		if((ua.indexOf('iPhone') > 0) || ua.indexOf('iPod') > 0 || (ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0)){
8			$('head').prepend('<meta name="viewport" content="width=device-width,initial-scale=1">');
9		} else {
10			$('head').prepend('<meta name="viewport" content="width=1200">');
11		}
12	});
13
14	// ブラウザサイズを変更したときにリロード
15	$(function() {
16
17		var timer = false;
18			$(window).on("orientationchange",function(){
19				if (timer !== false) {
20					clearTimeout(timer);
21				}
22				timer = setTimeout(function() {
23				location.reload();
24			}, 100);
25		});
26
27	});
28
29	//言語切替
30	$(function(){
31		$('.header_lang li').hover(function(){
32			$("ul:not(:animated)", this).slideDown();
33		}, function(){
34			$("ul.lang_list",this).slideUp();
35		});
36	});
37
38	$(function() {
39
40	    var timer = false;
41	    $(window).on("orientationchange",function(){
42	    if (timer !== false) {
43	    clearTimeout(timer);
44	    }
45	    timer = setTimeout(function() {
46	        location.reload();
47	    }, 100);
48	    });
49
50	});
51
52	// fixed_header の場合 containerにmargin-top設定
53	$(function(){
54		if(window.matchMedia( '(min-width: 768px)' ).matches && $('.fixed_header').length && !$('#top_container').length){
55			var hwh = $('.header_wrap').outerHeight(),
56				gwh = $('.gnav_wrap').outerHeight();
57			$('.title_wrap').css("margin-top", hwh + gwh + "px");
58		}
59	});
60	$(function(){
61		if(window.matchMedia( '(max-width: 767px)' ).matches && $('.fixed_header').length && !$('#top_container').length){
62			var hwh = $('.header_wrap').outerHeight();
63			$('.title_wrap').css("margin-top", hwh + "px");
64		}
65	});
66
67	function init() {
68		create();
69		eventify();
70		setup();
71	}
72
73	function create() {
74	}
75
76	function eventify() {
77	}
78
79	function setup() {
80		/* common_lib */
81		$.lib.util.linkAction({
82			gNavSelecter: ".gnav",
83			gNavHasHome: true,
84			sNavSelecter: [".sidenav ul", ".footer_nav"],
85			postFixRo: "_f2",
86			postFixCr: "_f3"
87		});
88		$('.pagetop a, .scroll_btn').scrollTo(); //スムーススクロール
89		$('.submenu_wrap').globalNaviSubMenu();
90		$('.pagetop').pagetopDisplayAnimation();
91
92		$('.clm2').mrbCut({items: "li.list_cont", colNum: 2}); //右端と最下段のマージンカット
93		$('.clm3').mrbCut({items: "li.list_cont", colNum: 3});
94		$('.clm4').mrbCut({items: "li.list_cont", colNum: 4});
95		$('.clm5').mrbCut({items: "li.list_cont", colNum: 5});
96
97		$(".linkbox li:has(a), .bt:has(a)").bigTarget({hoverClass: "hover"});
98	}
99
100	function windowload() {
101		$('.eq_height').eqHeight({items: ".list_inner"}); //横並びのコンテンツの高さを揃える
102	}
103
104	$(function () {
105		init();
106	});
107
108	$(window).on('load', function() {
109		windowload();
110	});
111
112	$(function(){
113		//global_acordion_navi menu
114		var menu = {};
115		menu.settings = {
116			viewController	: ".menu_btn a",
117			content			: "#global_acordion_navi",
118			dataPage		: $(this),
119			dataPageID		: $(this).attr('ID')
120		};
121		menu.init = function() {
122			this.eventify();
123		};
124		menu.eventify = function() {
125			var s = this.settings;
126			var $controller = $(s.viewController);
127			var $content = $(s.dataPage).find(s.content);
128			$controller.click(function() {
129				var isOpen = $content.hasClass("open");
130				if(isOpen) {
131					$('#'+ s.dataPageID +' .contents_wrap, #'+ s.dataPageID +' .footer_wrap').css('display','block');
132					$content.slideUp(300);
133					$content.removeClass("open");
134					var $changeBtnImgName = $(this).find('img').attr('src').replace('_close','_menu');
135					$(this).find('img').attr('src', $changeBtnImgName );
136				} else {
137					$content.css('top',$('#'+ s.dataPageID +' .header_wrap').height());
138					$('#'+ s.dataPageID +' .contents_wrap, #'+ s.dataPageID +' .footer_wrap').css('display','none');
139					$content.slideDown(300);
140					$content.addClass("open");
141					var $changeBtnImgName = $(this).find('img').attr('src').replace('_menu','_close');
142					$(this).find('img').attr('src', $changeBtnImgName );
143				}
144				return false;
145			});
146		};
147		menu.init();
148	});
149
150//############ SIDEBAR 固定 ###############
151
152	// sidebar の幅を取得
153	$(function(){
154		if($('.fixedmenu').length && $('.pc_container').length){
155			var sw = $('.side_area').outerWidth()
156				sh = $('.side_area').outerHeight();
157			$('.sidebar').css("width", sw + "px");
158			$('.main_area').css("min-height", sh + "px");
159		}
160	});
161
162	// サイドバー固定
163	$(function(){
164		if($('.fixedmenu').length && $('.pc_container').length){
165			var fix = $('.fixedmenu'), //固定したいコンテンツ
166				side = $('.side_area'), //サイドバーのID
167				main = $('.main_area'), //固定する要素を収める範囲
168				hwh = $('.header_wrap').outerHeight(),
169				gwh = $('.gnav_wrap').outerHeight(),
170				off = 20,
171				fxstart = hwh + gwh + off,
172				sideTop = side.offset().top,
173				fixTop = fix.offset().top,
174				mainTop = main.offset().top,
175				w = $(window);
176				if( $('.fixed_header').length){
177					var fxstart = hwh + gwh + off;
178				} else {
179					var fxstart = off;
180				};
181			var adjust = function(){
182				fixTop = fix.css('position') === 'static' ? sideTop + fix.position().top : fixTop;
183				var fixHeight = fix.outerHeight(true),
184					mainHeight = main.outerHeight(),
185					winTop = w.scrollTop() + fxstart;
186				if(winTop + fixHeight > mainTop + mainHeight){
187					fix.css({
188						position: 'absolute',
189						top: mainHeight - fixHeight
190				});
191				}else if(winTop >= fixTop){
192					fix.css({
193						position: 'fixed',
194						top: fxstart
195					});
196				}else{
197					fix.css('position', 'static');
198				}
199			}
200			w.on('scroll', adjust);
201		}
202	});
203
204//############ SIDEBAR 固定 ここまで ###############
205
206	// tab_switch
207	$(function() {
208		//クリックしたときのファンクションをまとめて指定
209		$('.tab_menu li').click(function() {
210
211			//.index()を使いクリックされたタブが何番目かを調べ、
212			//indexという変数に代入します。
213			var index = $('.tab_menu li').index(this);
214
215			//コンテンツを一度すべて非表示にし、
216			$('.tab_content_wrap .tab_content').css('display','none');
217
218			//クリックされたタブと同じ順番のコンテンツを表示します。
219			$('.tab_content_wrap .tab_content').eq(index).css('display','block');
220
221			//一度タブについているクラスselectを消し、
222			$('.tab_menu li').removeClass('select');
223
224			//クリックされたタブのみにクラスselectをつけます。
225			$(this).addClass('select')
226		});
227	});
228
229	// acordion menu
230	$(function(){
231		$(".ac_menu .ac_toggle").on("click", function() {
232			$(this).toggleClass("open").next().slideToggle();
233		});
234	});
235
236	// fade
237	$(function(){
238		$(window).bind('load', function(){
239			var sct = $(document).scrollTop();
240			var hei = $(window).height();
241			function anime(){
242				sct = $(document).scrollTop();
243				hei = $(window).height();
244				$(".fade").each( function(){
245					if($(this).offset().top + 200 < sct + hei){
246						$(this).animate({opacity:"1", right: 0}, 1000);
247					};
248				});
249			}
250			//スクロールした時
251			$(window).scroll(function () {
252				anime();
253			});
254			//リサイズした時
255			$(window).resize(function(){
256				anime();
257			});
258			anime();
259		});
260	});
261
262})(jQuery);

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.