PageSourceSearch

https://www.gunma-u.ac.jp/prospective/js/function.js

js gunma-u.ac.jp collected 2026-10-01 10:30:05 UTC 9,218 bytes, 349 lines download raw bytes

1/*******************************************
2
3     スマホとタブレットでviewportを切替え
4	 
5*******************************************/
6$(function(){
7    var ua = navigator.userAgent;
8    if((ua.indexOf('iPhone') > 0) || ua.indexOf('iPod') > 0 || (ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0)){
9        $('head').prepend('<meta name="viewport" content="width=device-width,initial-scale=1">');
10    } else {
11        $('head').prepend('<meta name="viewport" content="width=1340">');
12    } 
13});
14/*********************************
15
16	Easingの追加
17
18*********************************/
19 
20jQuery.easing.quart = function (x, t, b, c, d) {   
21 return -c * ((t=t/d-1)*t*t*t - 1) + b;
22}; 
23/*------------------------------------- 
24ページ読み込み中
25------------------------------------*/
26jQuery(document).ready(function(){ 
27	// <a href="#***">の場合、スクロール処理を追加 
28	jQuery('a[href*=#]').click(function() {
29		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 
30			var $target = jQuery(this.hash); 
31			 $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
32			if ($target.length) {
33				var targetOffset = $target.offset().top;
34				jQuery('html,body').animate({ scrollTop: targetOffset }, 500, 'quart'); 
35				return false;
36			}																		         
37		}																					
38	});
39});
40
41/*********************************
42
43	画像入れ替え
44
45*********************************/
46
47$(function(){
48	var setImg = '#viewer';
49	var fadeSpeed = 1500;
50	var switchDelay = 6000;
51
52	$(setImg).children('img').css({opacity:'0'});
53	$(setImg + ' img:first').stop().animate({opacity:'1',zIndex:'20'},fadeSpeed);
54
55	setInterval(function(){
56		$(setImg + ' :first-child').animate({opacity:'0'},fadeSpeed).next('img').animate({opacity:'1'},fadeSpeed).end().appendTo(setImg);
57	},switchDelay);
58});
59
60
61
62/*********************************
63
64	レスポンシブメニュー
65
66*********************************/
67$(function() {
68$(document).ready(function() { 
69$('nav').meanmenu(); 
70}); 
71});
72
73
74/*********************************
75
76	ページトップ、右固定ボタン
77
78*********************************/
79$(function() {
80    var topBtn = $('#page-top');    
81    topBtn.hide();
82    //スクロールが100に達したらボタン表示
83    $(window).scroll(function () {
84        if ($(this).scrollTop() > 100) {
85            topBtn.fadeIn();
86        } else {
87            topBtn.fadeOut();
88        }
89    });
90    //スクロールしてトップ
91    topBtn.click(function () {
92        $('body,html').animate({
93            scrollTop: 0
94        }, 500);
95        return false;
96    });
97});
98
99$(function() {
100    var topBtn = $('#float_button');    
101    topBtn.hide();
102    //スクロールが100に達したらボタン表示
103    $(window).scroll(function () {
104        if ($(this).scrollTop() > 100) {
105            topBtn.fadeIn();
106        } else {
107            topBtn.fadeOut();
108        }
109    });
110});
111
112/*******************************************
113
114     ヘッダー(追従)横スクロール対応
115	 
116*******************************************/
117$(window).on("scroll", function(){
118$("#header_content").css("left", -$(window).scrollLeft());
119});
120/*******************************************
121
122	画像スクロール(トップページ)
123
124*******************************************/
125$(document).ready(function(){
126    var huga = $('.bxslider').bxSlider({
127        auto: true,
128        mode: 'fade',
129        pause: 6000,
130        onSlideAfter: function(){
131        huga.startAuto();
132        }
133    });
134});
135/*******************************************
136
137	画像スクロール(第二階層右下)
138
139*******************************************/
140$(document).ready(function(){
141    var huga = $('.bxslider2').bxSlider({
142        auto: true,
143        mode: 'horizontal',
144		controls: false,
145        pause: 4000,
146        onSlideAfter: function(){
147        huga.startAuto();
148        }
149    });
150});
151
152
153/*******************************************
154
155	divアコーディオン
156	
157*******************************************/
158$(function(){
159    $(".div_acdn_title").on("click", function() {
160        $(this).next().slideToggle();
161        $(this).toggleClass("active");
162    });
163$(".div_acdn_content").mouseover(function(){
164    $(this).addClass("over");   
165});
166$(".div_acdn_content").mouseout(function(){
167    $(this).removeClass("over");    
168});
169});
170
171	
172/*******************************************
173
174	divアコーディオン(保護者が知りたい)
175	
176*******************************************/
177
178
179$(function(){
180    $(".answer_q").on("click", function() {
181        $(this).next().slideToggle();
182        $(this).toggleClass("active");
183    });
184$(".answer_a").mouseover(function(){
185    $(this).addClass("over");   
186});
187$(".answer_a").mouseout(function(){
188    $(this).removeClass("over");    
189});
190});
191
192
193
194/*******************************************
195
196     理工学部 研究室紹介 展開
197	 
198*******************************************/
199
200$(function(){
201    $(".sub_title_acdn").on("click", function() {
202        $(this).next().slideToggle();
203        $(this).toggleClass("active");
204    });
205$(".sub_title_acdn_contents").mouseover(function(){
206    $(this).addClass("over");   
207});
208$(".sub_title_acdn_contents").mouseout(function(){
209    $(this).removeClass("over");    
210});
211});
212
213/*******************************************
214
215     リケジョインタビュー 展開
216	 
217*******************************************/
218
219$(function(){
220    $(".rikejo_div_content_acdn_open").on("click", function() {
221        $(this).next().slideToggle();
222        $(this).toggleClass("active");
223    });
224$(".sub_title_acdn_contents").mouseover(function(){
225    $(this).addClass("over");   
226});
227$(".sub_title_acdn_contents").mouseout(function(){
228    $(this).removeClass("over");    
229});
230});
231
232
233/*******************************************
234
235     ドロップダウンメニューの設定
236
237*******************************************/
238$(function(){
239  $('#mddNav > ul > li').hover(function(){
240	$(this).addClass("over");  
241    childPanel = $(this).children('.mddWrap');
242    childPanel.each(function(){
243  childPanel.css({height:'0',display:'block',opacity:'0'}).stop().animate({height:'280',opacity:'1'},500,'swing');
244    });
245  },function(){
246    childPanel.css({display:'none'});
247	$(this).removeClass("over");  
248  });
249});
250
251
252
253
254
255/*******************************************
256
257スクロールしたら、要素にclassを追加(fade用)
258
259*******************************************/
260$(function(){
261    $(window).scroll(function (){
262        $('.fadein').each(function(){
263            var elemPos = $(this).offset().top;
264            var scroll = $(window).scrollTop();
265            var windowHeight = $(window).height();
266            if (scroll > elemPos - windowHeight + 100){
267                $(this).addClass('scrollin');
268            }
269        });
270    });
271});
272
273
274
275
276/*******************************************
277
278トップページパララックス
279
280*******************************************/
281$(function(){
282	var t;
283	var ani;
284	$('.iv').on('inview', function(event, isInView) {
285		if (isInView) {
286			t = $(this).attr("data-time") ? $(this).attr("data-time") : 0;
287			$(this).delay(t).queue(function(){
288				ani = $(this).attr("class").match(/iv\-([A-Za-z]+)/);
289				$(this).addClass('animated '+ani[1]);
290				$(this).css('opacity',1);
291			});
292		} 
293	});
294});
295
296
297/*******************************************
298
299     フッタースマホ用サブメニュー展開(スマホ時のみ)
300	 
301*******************************************/
302$(function(){
303if (window.matchMedia( "(max-width: 480px)" ).matches) {
304
305$(function(){
306    $(".footer_menu_sub_title_acdn").on("click", function() {
307        $(this).next().slideToggle();
308        $(this).toggleClass("active");
309    });
310$(".div_acdn_content").mouseover(function(){
311    $(this).addClass("over");   
312});
313$(".div_acdn_content").mouseout(function(){
314    $(this).removeClass("over");    
315});
316});
317
318}})
319
320
321
322/*******************************************
323	
324ヘッダ固定時のページ内リンク 上部余白設定(ヘッダの高さ分、位置をずらして移動)
325
326*******************************************/
327
328
329 jQuery(function() {
330    var windowWidth = $(window).width();
331    var windowSm = 698; // スマホに切り替わる横幅
332    if (windowWidth <= windowSm) {
333      var headerHight = 70; // スマホのヘッダー等の高さ分の数値を入れる
334    } else {
335      var headerHight = 100; // PC のヘッダー等の高さ分の数値を入れる
336    }
337    jQuery('[href^="#"]').click(function() {
338      var speed = 500;
339      var href = jQuery(this).attr("href");
340      var target = jQuery(href == "#" || href == "" ? "html" : href);
341      var position = target.offset().top - headerHight;
342      jQuery("body,html").animate({ scrollTop: position }, speed, "swing");
343      return false;
344    });
345  });
346
347
348
349

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.