PageSourceSearch

https://yamada-ya.com/js/common.js

js yamada-ya.com collected 2026-10-02 06:23:30 UTC 2,140 bytes, 113 lines download raw bytes

1
2// / で終わるリンクに index.htmlを付ける。
3$(function(){
4	
5	// 本番では、↓の先頭に // を付けてコメントにする
6	$('a[href$="/"]').click(function(){this.href += 'index.html';});
7	
8});
9
10
11// ページ内リンクのスクロール
12$(function(){
13	$('a')
14	.each(function(){
15		var $a = $(this)
16			, href = $a.attr('href');
17		if (href.substr(0, 1) == '#'){
18			$a
19			.click(function(){
20				var href = $(this).attr('href')
21					, target = document.getElementById(href.substr(1));
22				if (target){
23					$('html,body').animate({ scrollTop: $(target).offset().top }, 'slow', null);
24				} else {
25					$('html,body').animate({ scrollTop: 0 }, 'slow', null);
26				}
27				return false;
28			});
29		}
30	});
31});
32
33
34// 背景の雲
35$(function(){
36	
37	$('#background_cloud').height($('body').height()).show();
38	
39	$(window)
40	.resize(function(){
41		
42		var $window = $(window);
43		var center = $window.width() / 2;
44		
45		$('#background_cloud .cloud').each(function(){
46			var $this = $(this);
47			var pos = $(this).attr('center_left');
48			if (typeof pos != 'undefined'){
49				this.style.marginLeft = ((center - this.width) - pos) + 'px';
50			} else {
51				var pos = $(this).attr('center_right');
52				if (typeof pos != 'undefined'){
53					this.style.marginLeft = (center + (pos-0)) + 'px';
54				}
55			}
56		});
57		
58	})
59	.resize()
60	;
61	
62});
63
64
65// フローティングメニュー
66$(function(){
67	
68	$('#float-menu .menu li a img, a.image-hover img')
69	.each(function(){
70		this.default_src = this.src;
71	})
72	.hover(function(){
73		this.src = this.default_src.replace('_off.svg', '_on.svg');
74	}, function(){
75		this.src = this.default_src;
76	});
77	
78});
79
80
81// 高さを揃える
82window.alignTheHeights = function(cols, selector){
83	var colItems = [];
84	var counter = 0;
85	var set = function(colItems){
86		var max = 0;
87		for(var i in colItems){
88			var h = $(colItems[i]).height();
89			if (h > max){
90				max = h;
91			}
92		}
93		for(var i in colItems){
94			colItems[i].style.height = max + 'px';
95		}
96	};
97	$(selector).each(function(){
98		counter++;
99		colItems.push(this);
100		if (counter == cols){
101			set(colItems);
102			counter = 0;
103			colItems = [];
104		}
105	});
106	set(colItems);
107	
108};
109
110
111
112
113

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.