PageSourceSearch

https://www.ascam.net/_js/onload.js

js ascam.net collected 2026-10-07 22:44:00 UTC 4,639 bytes, 196 lines download raw bytes

1(function($){
2	
3	$(function(){
4
5		//spmenu
6		var headerObj = $('#wrp_hdr');
7		var menuBtn = $('#btn_menu a');
8		var spMenu = $('#sp_menu');
9		var menuTxtObj = menuBtn.find('.txt');
10		var menuTxt = menuTxtObj.text();
11		var closeTxt = 'CLOSE';
12		$(window).on('load',function(){
13			menuBtn.on('click',function(){
14				var spMenuInr = spMenu.find('.toggle_menu');
15				if(!menuBtn.hasClass('active')){
16					menuBtn.addClass('active');
17					spMenu.addClass('active').css({
18						top: headerObj.outerHeight()
19					});
20					menuTxtObj.text(closeTxt);
21					spMenuInr.css({
22						maxHeight: spMenuInr.find('.inr_toggle_menu').outerHeight()
23					});
24				}else{
25					$.when(
26						spMenuInr.css({
27							maxHeight: 0
28						})
29					).done(function(){
30						menuBtn.removeClass('active');
31						spMenu.removeClass('active');
32						menuTxtObj.text(menuTxt);
33					});
34				}
35			});
36			spMenu.on('click',function(){
37				menuBtn.trigger('click');
38			});
39		});
40		
41
42		
43	
44		
45		
46		//アンカーリンクした場合フローティングしている高さ分ずらす
47				var fixedHeightL = headerObj.outerHeight();
48				var flg = 0;
49
50				$('a[href*="#"]').click(function() {
51					var href= $(this).attr('href');
52					var hash = href.replace(/.*#/g,'');
53					moveAnchor(hash);
54					if(flg){
55						flg = 0;
56						return false;
57					}
58				});
59				
60				var thisPath = location.href;
61				var thisAnchor = thisPath.replace(/.*#/g,'');
62				if(thisAnchor){
63					moveAnchor(thisAnchor);
64				}
65				
66				function moveAnchor(targetAnchor) {
67					$('body').find('a').each(function() {
68						var self = $(this);
69						var anchorName = self.attr('name');
70						if(targetAnchor == anchorName){
71							if(!self.is(':visible')){
72								self.append(' ');
73							}
74							var position = self.offset().top - fixedHeightL;
75							$(window).scrollTop(position);
76							flg = 1;
77						}
78					});
79				}
80				
81				
82
83//accordion
84		var switchObj = $('#maincontent .switch');
85		if(switchObj.length){
86			var switchBtn = switchObj.find('.switch_ttl a');
87			var switchcnt = $('#maincontent .switch_cnt');
88			var closeText = '閉じる';
89			switchcnt.hide();
90			switchBtn.each(function(){
91				var self = $(this);
92				var switchText = self.find('span').text();
93				self.on('click', function(){
94					var activeThis = self.parents('.switch')
95					activeThis.toggleClass('active');
96					activeThis.find('.switch_cnt').toggle();
97
98					if(activeThis.hasClass('active')){
99						self.find('span').text(closeText);
100					}else{
101						self.find('span').text(switchText);
102					}
103					return false;
104				});
105			});
106		}
107
108		
109		//pagetop
110		var pagetopBtn = $('.pagetop');
111		$(window).scroll(function(){
112			if ($(this).scrollTop() > 100) {
113				pagetopBtn.addClass('fixed');
114			} else {
115				pagetopBtn.removeClass('fixed');
116			}
117		});
118
119		//fc only
120		var spmenuSub = spMenu.find('ul').find('ul');
121		if(spmenuSub.length){
122			spmenuSub.each(function(){
123				var self = $(this);
124				var firstLiA = self.find('li:first-child a').attr('href');
125				self.prev().attr('href', firstLiA);
126			});
127		}
128
129		//headフローティング
130		headerObj.next().css({
131			paddingTop: headerObj.outerHeight()
132		});
133		var timer = false;
134		$(window).on('resize',function(){
135			if (timer !== false) {
136				clearTimeout(timer);
137			}
138			timer = setTimeout(function() {
139				headerObj.next().css({
140					paddingTop: headerObj.outerHeight()
141				});
142			}, 100);
143		})
144		
145	
146			//ヘッダーフローティング後にclass
147		
148		$(function() {
149  var $win = $(window),
150      $header = $('#wrp_hdr'),
151      animationClass = 'is-animation';
152
153  $win.on('load scroll', function() {
154    var value = $(this).scrollTop();
155    if ( value > 100 ) {
156      $header.addClass(animationClass);
157    } else {
158      $header.removeClass(animationClass);
159    }
160  });
161});
162
163//chrome用アンカーリンクの位置調整。アンカー側がnameの場合はidも指定しないと動かない。
164$(window).on('load', function() {
165var url = $(location).attr('href');
166if(url.indexOf("#") != -1){
167var anchor = url.split("#");
168var target = $('#' + anchor[anchor.length - 1]);
169if(target.length){
170var pos = Math.floor(target.offset().top) - 90;
171$("html, body").animate({scrollTop:pos}, 100);
172}
173}
174});
175
176//2.3以降追加アンカー調整
177jQuery(function(){
178    var windowWidth = $(window).width();
179    var headerHight = 100; 
180    jQuery('a[href^=#]').click(function() {
181    var speed = 1000;
182    var href= jQuery(this).attr("href");
183    var target = jQuery(href == "#" || href == "" ? 'html' : href);
184    var position = target.offset().top-headerHight;
185    jQuery('body,html').animate({scrollTop:position}, speed, 'swing');
186    return false;
187   });
188});
189
190
191	
192	
193
194	});
195
196})(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.