PageSourceSearch

https://unicornwars.jp/css/common.js

js unicornwars.jp collected 2026-10-07 00:09:03 UTC 2,959 bytes, 134 lines download raw bytes

1$(function() {
2	
3	var winH;
4	var winW;
5	var minW;
6	var minH;
7	
8	var win = $(window),
9			wrap = $('#wrap'),
10			cover = $('#cover');
11	
12	//var cover = $('#cover');
13	var openingSpeed = 1600;
14	//var openingSpeed = 1;
15	var modalSpeed = 600;
16		
17	init();
18	function init() {
19		//wrap.css('opacity', 0);
20		var baseWidth = $(window).width();
21		var w = baseWidth;
22		if(baseWidth >= 768){
23			w = baseWidth*0.8;
24		}
25		var h = w*0.57;
26		if(baseWidth >= 1240){
27			w = 1046;
28			h = 588;
29		}
30		$(".modalTrailer").colorbox({
31			iframe:true,
32			innerWidth:w,
33			innerHeight:h,
34			speed: modalSpeed,
35			scrolling:false,
36		});
37	}
38	
39	// ロード完了後
40	win.on('load', function() {
41		
42		winH = win.height();
43		winW = win.width();
44		cover.fadeOut(80, function(){
45			wrap.animate({
46				'opacity': 1
47			}, openingSpeed, 'linear', function() {
48				if(winW>279) {
49					autoPlayTrailer();
50				}
51			});
52		});
53	});
54	
55	// リサイズ
56	win.on('resize', function() {
57		winH = win.height();
58		winW = win.width();
59	});
60	// スクロール
61	win.on('scroll', function() {
62	});
63	
64	function autoPlayTrailer() {
65		setTimeout(function() {
66			$('.modalTrailer').click();
67		}, 1200);
68	}
69	
70	// accordion
71	$('.js-accordion-title').on('click', function () {
72		$(this).next().slideToggle(200);
73		$(this).toggleClass('open', 200);
74	});
75	
76	// メニュー
77	$('.hamburger').click(function() {
78		$(this).toggleClass('active');
79		if ($(this).hasClass('active')) {
80			$('#gnav').addClass('active');
81		} else {
82			$('#gnav').removeClass('active');
83		} 
84	});
85	//メニュー内を閉じておく
86	$('#gnav a[href]').click(function() {
87		$('#gnav').removeClass('active');
88		$('.hamburger').removeClass('active');
89	});
90
91	// iOSの時はパララックスなし
92	const ua = navigator.userAgent.toLowerCase()
93	const r = document.getElementById('r')
94	if (/ipod|ipad|iphone|macintosh/.test(ua) && 'ontouchend' in document) {
95		$('.itvL-1').css('background-attachment','scroll');
96		$('.itvL-2').css('background-attachment','scroll');
97		$('.itvL-3').css('background-attachment','scroll');
98		$('.itvL-4').css('background-attachment','scroll');
99	}
100
101	// スクロール位置に合わせてカレント表示
102	var sectionArr = new Array();
103	var elIndex = $('#gnav a');
104	for(i=0; i < elIndex.length; i++){
105		var elLink = elIndex.eq(i).attr('href');
106		if(elLink.charAt(0) == '#') {
107			sectionArr[i] = elLink;
108		}
109	}
110	$(window).on('load resize scroll', function(){
111		var top = $(window).scrollTop() + ($(window).height() / 2);
112		for(i=0; i < sectionArr.length; i++){
113			var target = sectionArr[i];
114			var secTop = $(target).offset().top;
115			var secBottom = secTop + $(target).outerHeight(true);
116			if(secTop <= top && secBottom >= top){
117				elIndex.removeClass('current');
118				elIndex.eq(i).addClass('current');
119			}
120		}
121	});
122
123	// slick
124	$('.slick-box').slick({
125		dots: true,
126		arrows: true,
127		autoplay: true,
128		autoplaySpeed: 5000,
129		prevArrow:'<div class="prev"></div>',
130		nextArrow:'<div class="next"></div>',
131	});
132	
133});
134

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.