PageSourceSearch

https://www.jst.go.jp/jisedai/mirainohakushi2026/js/cmn.js

js jst.go.jp collected 2026-09-24 06:43:33 UTC 5,528 bytes, 200 lines download raw bytes

1///// IE8-IE10対応 /////
2function alertIE(){
3		var ua = navigator.userAgent;
4		if ( ua.indexOf('MSIE 8') !== -1 || ua.indexOf('MSIE 9') !== -1 || ua.indexOf('MSIE 10') !== -1) {
5				$('body').prepend(
6						'<div class="IE">お使いのInternet Explorerは古いバージョンのため、ホームページが正しく表示されない可能性があります。<br>最新のバージョンにアップデートするか、別のブラウザからご利用ください。</div>'
7				);
8		}
9}
10
11//SP_gnav
12$(function(){
13
14	$('.menu_trigger').click(function(){
15		$('.menu').stop(true, true).fadeToggle(500);
16		$('.menu_trigger').toggleClass('active');
17		$('.layer').stop(true, true).fadeToggle();
18	});
19
20	$('.close').click(function(){
21		$('.menu').stop(true, true).fadeToggle(500);
22		$('.layer').stop(true, true).fadeToggle();
23		$('.menu_trigger').toggleClass('active');
24	});
25
26	// メニュークリック
27	$('.menu li a').click(function(){
28		if(window.innerWidth <= 768){
29			$('.menu').stop(true, true).fadeToggle(500);
30			$('.layer').stop(true, true).fadeToggle();
31			$('.menu_trigger').removeClass('active');
32		}
33	});
34
35});
36
37// リサイズ時
38$(window).on('resize', function(){
39	if(window.innerWidth > 768){
40		$('.menu').removeAttr('style');
41		$('.layer').removeAttr('style');
42		$('.menu_trigger').removeClass('active');
43	}
44});
45
46//ページトップJS
47$(function() {
48	var topBtn = $('#page-top');
49	topBtn.hide();
50	//スクロールが100に達したらボタン表示
51	$(window).scroll(function () {
52		if ($(this).scrollTop() > 100) {
53			topBtn.fadeIn();
54		} else {
55			topBtn.fadeOut();
56		}
57	});
58	//スクロールしてトップ
59	topBtn.click(function () {
60		$('body,html').animate({
61			scrollTop: 0
62		}, 600);
63		return false;
64	});
65});
66
67//スムーズスクロール
68$(function(){
69  // #で始まるa要素をクリックした場合に処理("#"←ダブルクォーテンションで囲むのを忘れずに。忘れるとjQueryのバージョンによっては動かない。。)
70  $('a[href^="#"]').click(function(){
71    // 移動先を0px調整する。0を30にすると30px下にずらすことができる。
72    var adjust = 0;
73    // スクロールの速度(ミリ秒)
74    var speed = 800;
75    // アンカーの値取得 リンク先(href)を取得して、hrefという変数に代入
76    var href= $(this).attr("href");
77    // 移動先を取得 リンク先(href)のidがある要素を探して、targetに代入
78    var target = $(href == "#" || href == "" ? 'html' : href);
79    // 移動先を調整 idの要素の位置をoffset()で取得して、positionに代入
80    var position = target.offset().top + adjust;
81    // スムーススクロール linear(等速) or swing(変速)
82    $('body,html').animate({scrollTop:position}, speed, 'swing');
83    return false;
84  });
85});
86
87//telタグPC無効
88var ua = navigator.userAgent;
89if (ua.indexOf('iPhone') < 0 && ua.indexOf('Android') < 0) {
90	$('a[href^="tel:"]').css('cursor', 'default').click(function (event) {
91		event.preventDefault();
92	});
93}
94
95//ViewPort切り替え
96$(function(){
97	var ua = navigator.userAgent;
98	if((ua.indexOf('iPhone') > 0) || ua.indexOf('iPod') > 0 || (ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0)){
99		$('head').prepend('<meta name="viewport" content="width=device-width,initial-scale=1">');
100	} else {
101		$('head').prepend('<meta name="viewport" content="width=1000">');
102	}
103});
104
105$(function () {
106  $(window).scroll(function () {
107    $('.circle').each(function () {
108      const targetElement = $(this).offset().top;
109      const scroll = $(window).scrollTop();
110      const windowHeight = $(window).height();
111      if (scroll > targetElement - windowHeight) {
112        $(this).addClass('view');
113      }
114    });
115  });
116
117
118
119});
120
121
122$(function() {
123	$("ul.menu").droppy();
124	});
125		
126		$.fn.droppy = function(options) {
127		
128		options = $.extend({speed: 150}, options || {});
129		
130		this.each(function() {
131		
132		var root = this, zIndex = 1000;
133		
134		function getSubnav(ele) {
135		if (ele.nodeName.toLowerCase() == 'li') {
136		var subnav = $('> ul', ele);
137		return subnav.length ? subnav[0] : null;
138		} else {
139		return ele;
140		}
141		}
142		
143		function getActuator(ele) {
144		if (ele.nodeName.toLowerCase() == 'ul') {
145		return $(ele).parents('li')[0];
146		} else {
147		return ele;
148		}
149		}
150		
151		function hide() {
152		var subnav = getSubnav(this);
153		if (!subnav) return;
154		$.data(subnav, 'cancelHide', false);
155		setTimeout(function() {
156		if (!$.data(subnav, 'cancelHide')) {
157		$(subnav).slideUp(options.speed);
158		}
159		}, 100);
160		}
161		
162		function show() {
163		var subnav = getSubnav(this);
164		if (!subnav) return;
165		$.data(subnav, 'cancelHide', true);
166		$(subnav).css({zIndex: zIndex++}).slideDown(options.speed);
167		if (this.nodeName.toLowerCase() == 'ul') {
168		var li = getActuator(this);
169		$(li).addClass('hover');
170		$('> a', li).addClass('hover');
171		}
172		}
173		
174		$('ul, li', this).hover(show, hide);
175		$('li', this).hover(
176		function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); },
177		function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); }
178		);
179		
180		
181		$('ul, li', this).keyup(show);
182		$('li', this).keyup(
183		function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }
184		);
185		
186		$('ul, li:last', this).keydown(hide);
187		$('li:last', this).keydown(
188		function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover');}
189		);
190		
191		});
192		
193		};
194
195$(function(){
196	$('.aco p.sp_only').on('click',function(){
197		$(this).next('.aco_child').slideToggle();
198		$(this).toggleClass('active');
199	})
200})

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.