PageSourceSearch

https://www.kazita.jp/wp2019/wp-content/themes/kajita/js/common.js

js kazita.jp collected 2026-10-06 12:26:09 UTC 5,187 bytes, 181 lines download raw bytes

1/**
2 * common.js
3 *
4 *  version --- 1.0
5 *  updated --- 2017/11/30
6 */
7
8
9/* !stack ------------------------------------------------------------------- */
10jQuery(document).ready(function($) {
11	pageScroll();
12	rollover();
13	common();
14  
15});
16
17/* !isUA -------------------------------------------------------------------- */
18var isUA = (function(){
19	var ua = navigator.userAgent.toLowerCase();
20	indexOfKey = function(key){ return (ua.indexOf(key) != -1)? true: false;}
21	var o = {};
22	o.ie      = function(){ return indexOfKey("msie"); }
23	o.fx      = function(){ return indexOfKey("firefox"); }
24	o.chrome  = function(){ return indexOfKey("chrome"); }
25	o.opera   = function(){ return indexOfKey("opera"); }
26	o.android = function(){ return indexOfKey("android"); }
27	o.ipad    = function(){ return indexOfKey("ipad"); }
28	o.ipod    = function(){ return indexOfKey("ipod"); }
29	o.iphone  = function(){ return indexOfKey("iphone"); }
30	return o;
31})();
32
33/* !rollover ---------------------------------------------------------------- */
34var rollover = function(){
35	var suffix = { normal : '_no.', over   : '_on.'}
36	$('a.over, img.over, input.over').each(function(){
37		var a = null;
38		var img = null;
39
40		var elem = $(this).get(0);
41		if( elem.nodeName.toLowerCase() == 'a' ){
42			a = $(this);
43			img = $('img',this);
44		}else if( elem.nodeName.toLowerCase() == 'img' || elem.nodeName.toLowerCase() == 'input' ){
45			img = $(this);
46		}
47
48		var src_no = img.attr('src');
49		var src_on = src_no.replace(suffix.normal, suffix.over);
50
51		if( elem.nodeName.toLowerCase() == 'a' ){
52			a.bind("mouseover focus",function(){ img.attr('src',src_on); })
53			 .bind("mouseout blur",  function(){ img.attr('src',src_no); });
54		}else if( elem.nodeName.toLowerCase() == 'img' ){
55			img.bind("mouseover",function(){ img.attr('src',src_on); })
56			   .bind("mouseout", function(){ img.attr('src',src_no); });
57		}else if( elem.nodeName.toLowerCase() == 'input' ){
58			img.bind("mouseover focus",function(){ img.attr('src',src_on); })
59			   .bind("mouseout blur",  function(){ img.attr('src',src_no); });
60		}
61
62		var cacheimg = document.createElement('img');
63		cacheimg.src = src_on;
64	});
65};
66/* !pageScroll -------------------------------------------------------------- */
67var pageScroll = function(){
68	jQuery.easing.easeInOutCubic = function (x, t, b, c, d) {
69		if ((t/=d/2) < 1) return c/2*t*t*t + b;
70		return c/2*((t-=2)*t*t + 2) + b;
71	}; 
72	
73	$(window).on('load resize',function(){
74		var scrolltop = $('#header').height(); //header fixed
75		if($(window).width() > 767){
76			$('a.scroll, .scroll a').each(function(){
77				$(this).unbind('click').bind("click keypress",function(e){
78					e.preventDefault();
79					var target  = $(this).attr('href');
80					//var targetY = $(target).offset().top-scrolltop; //header fixed
81					var targetY = $(target).offset().top;
82					var parent  = ( isUA.opera() )? (document.compatMode == 'BackCompat') ? 'body': 'html' : 'html,body';
83					$(parent).animate(
84						{scrollTop: targetY },
85						400
86					);
87					$(".btnMenu").removeClass("active");
88	        		$("#gNavi").removeClass("active");
89					return false;
90				});
91			});
92		}
93		else{
94			$('a.scroll, .scroll a').each(function(){
95				$(this).unbind('click').bind("click keypress",function(e){
96					e.preventDefault();
97					var target  = $(this).attr('href');
98					//var targetY = $(target).offset().top-scrolltop; //header fixed
99					var targetY = $(target).offset().top-scrolltop;
100					var parent  = ( isUA.opera() )? (document.compatMode == 'BackCompat') ? 'body': 'html' : 'html,body';
101					$(parent).animate(
102						{scrollTop: targetY },
103						400
104					);
105					$(".btnMenu").removeClass("active");
106	        		$("#gNavi").removeClass("active");
107					return false;
108				});
109			});
110		}
111	});
112	
113	$('.pageTop a').click(function(){
114		$('html,body').animate({scrollTop: 0}, 'slow','swing');
115		return false;
116	});
117}
118
119
120
121/* !common --------------------------------------------------- */
122var common = (function(){
123	
124	//スマホグローバルナビ
125	$(".btnMenu a").click(function(){
126    if($(".btnMenu").hasClass("active")){
127      $(".btnMenu").removeClass("active");
128      $("#gNavi").removeClass("active");
129    }else{
130      $(".btnMenu").addClass("active");
131      $("#gNavi").addClass("active");
132    }
133  });
134  $(".topWrap").addClass("on");
135	$(window).resize(function(){
136		setTimeout(function(){
137			if($(window).width() > 767) {
138				$("#gNavi").removeClass("active");
139        		$(".btnMenu").removeClass("active");
140			}
141		},500);
142	});
143	$('.biggerlink').biggerlink();
144  
145  $('.imgBox').each(function(){
146    $(this).css({backgroundImage: 'url('+$(this).data('img')+')'});
147  });
148
149	$(window).scroll(function(){
150		var top = $(window).height()+$(window).scrollTop();
151		$(".indexList,.linkWrap").each(function(){
152			if(($(this).offset().top) < top){
153				if(!$(this).hasClass("on")){
154					$(this).addClass("on");
155				}
156			}
157		});
158		$(".animated").each(function(){
159			if(($(this).offset().top) < top){
160				if(!$(this).hasClass("fadeInUp")){
161					$(this).addClass("fadeInUp");
162				}
163			}
164		});
165
166	});
167
168		// animation
169	var wow = new WOW({
170	    boxClass: 'wow',
171	    animateClass: 'animated02',
172	    offset: 0,
173	    mobile: true,
174	    live: true
175	});
176	wow.init();
177
178}
178);
179
180
181

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.