PageSourceSearch

https://bv-baby.jp/blog/wp-content/themes/bloom_tcd053/js/functions.js?ver=1.8.1

js bv-baby.jp collected 2026-10-04 21:07:50 UTC 11,318 bytes, 404 lines download raw bytes

1jQuery(function($){
2
3	/**
4	 * グローバルナビゲーション モバイル
5	 */
6	$('#js-menu-button').click(function() {
7		if ($('#js-header').width() <= 1200) {
8			$(this).toggleClass('is-active');
9			$('#js-global-nav').slideToggle(500);
10		}
11		return false;
12	});
13	$('#js-global-nav .menu-item-has-children > a span').click(function() {
14		if ($('#js-header').width() <= 1200) {
15			$(this).toggleClass('is-active');
16			$(this).closest('.menu-item-has-children').toggleClass('is-active').find('> .sub-menu').slideToggle(300);
17		}
18		return false;
19	});
20
21	/**
22	 * ヘッダー検索
23	 */
24	$('#js-header #js-search-button').click(function() {
25		if ($('#js-header').width() > 1200) {
26			$(this).closest('#js-header').toggleClass('is-header-search-active');
27		}
28		return false;
29	});
30
31	/**
32	 * メガメニュー
33	 */
34	var hide_megamenu_timer = {};
35	var hide_megamenu_interval = function(menu_id) {
36		if (hide_megamenu_timer[menu_id]) {
37			clearInterval(hide_megamenu_timer[menu_id]);
38			hide_megamenu_timer[menu_id] = null;
39		}
40		hide_megamenu_timer[menu_id] = setInterval(function() {
41			if (!$('#menu-item-' + menu_id).is(':hover') && !$('#p-megamenu--' + menu_id).is(':hover')) {
42				clearInterval(hide_megamenu_timer[menu_id]);
43				hide_megamenu_timer[menu_id] = null;
44				$('#menu-item-' + menu_id + ', #p-megamenu--' + menu_id).removeClass('is-active');
45			}
46		}, 20);
47	};
48	$('#js-global-nav .menu-megamenu').hover(
49		function(){
50			var menu_id = $(this).attr('id').replace('menu-item-', '');
51			if (hide_megamenu_timer[menu_id]) {
52				clearInterval(hide_megamenu_timer[menu_id]);
53				hide_megamenu_timer[menu_id] = null;
54			}
55			if ($('#js-header').width() > 1200) {
56				$(this).addClass('is-active');
57				$('#p-megamenu--' + menu_id).addClass('is-active');
58			}
59		},
60		function(){
61			var menu_id = $(this).attr('id').replace('menu-item-', '');
62			hide_megamenu_interval(menu_id);
63		}
64	);
65	$('#js-header').on('mouseout', '.p-megamenu', function(){
66		var menu_id = $(this).attr('id').replace('p-megamenu--', '');
67		hide_megamenu_interval(menu_id);
68	});
69
70	/**
71	 * メガメニューB (type3)
72	 */
73	$('.p-megamenu--type3 > ul > li > a').hover(
74		function(){
75			var $li = $(this).closest('li');
76			$li.addClass('is-active');
77			$li.siblings('.is-active').removeClass('is-active');
78		},
79		function(){}
80	);
81
82	/**
83	 * ページトップ
84	 */
85	var pagetop = $('#js-pagetop');
86	pagetop.hide().click(function() {
87		$('body, html').animate({
88			scrollTop: 0
89		}, 1000);
90		return false;
91	});
92	$(window).scroll(function() {
93		if ($(this).scrollTop() > 100) {
94			pagetop.fadeIn(1000);
95		} else {
96			pagetop.fadeOut(300);
97		}
98	});
99
100	/**
101	 * トップページタブ
102	 */
103	$('#js-index-tab .p-index-tab__item .p-index-tab__link').click(function() {
104		if ($(this).closest('.p-index-tab__item').hasClass('is-active')) return false;
105		var target = $(this).attr('href');
106		$(this).closest('.p-index-tab__item').addClass('is-active').siblings('.is-active').removeClass('is-active');
107		$('.p-index-tab-content:visible').stop().removeClass('is-active').fadeOut(300);
108		$(target).delay(300).fadeIn(1000, function(){
109			$(this).addClass('is-active');
110			if ($('#js-footer-cta').length) {
111				$(window).trigger('resize');
112			}
113		});
114		return false;
115	});
116
117	/**
118	 * トップページタブ ページャー
119	 */
120	$(document).on('click', '.p-index-tab-content .p-pager[data-tab][data-ajax-url] a[data-page]', function() {
121		var $content = $(this).closest('.p-index-tab-content');
122		var $pager = $(this).closest('.p-pager');
123
124		if ($content.hasClass('is-ajaxing')) return false;
125		$content.addClass('is-ajaxing');
126
127		$.post(
128			$pager.attr('data-ajax-url'),
129			{
130				action: 'index_tab_pagenate',
131				tab: $pager.attr('data-tab'),
132				page: $(this).attr('data-page')
133			},
134			function (html) {
135				$content.removeClass('is-ajaxing');
136				if (html) {
137					$content.fadeOut(300, function(){
138						$(window).scrollTop($('#js-index-tab').offset().top - 80);
139						$content.html(html).fadeIn(1000);
140						if ($('#js-footer-cta').length) {
141							$(window).trigger('resize');
142						}
143					});
144				}
145			}
146		);
147
148		return false;
149	});
150
151	/**
152	 * 記事一覧でのカテゴリークリック
153	 */
154	$('article a span[data-url]').hover(
155		function(){
156			var $a = $(this).closest('a');
157			$a.attr('data-href', $a.attr('href'));
158			if ($(this).attr('data-url')) {
159				$a.attr('href', $(this).attr('data-url'));
160			}
161		},
162		function(){
163			var $a = $(this).closest('a');
164			$a.attr('href', $a.attr('data-href'));
165		}
166	);
167
168	/**
169	 * コメント
170	 */
171	if ($('#js-comment__tab').length) {
172		var commentTab = $('#js-comment__tab');
173		commentTab.find('a').click(function() {
174			if (!$(this).parent().hasClass('is-active')) {
175				$($('.is-active a', commentTab).attr('href')).animate({opacity: 'hide'}, 0);
176				$('.is-active', commentTab).removeClass('is-active');
177				$(this).parent().addClass('is-active');
178				$($(this).attr('href')).animate({opacity: 'show'}, 1000);
179			}
180			return false;
181		});
182	}
183
184	/**
185	 * カテゴリー ウィジェット
186	 */
187	$('.p-widget-categories li ul.children').each(function() {
188		$(this).closest('li').addClass('has-children');
189		$(this).hide().before('<span class="toggle-children"></span>');
190	});
191	$('.p-widget-categories .toggle-children').click(function() {
192		$(this).closest('li').toggleClass('is-active').find('> ul.children').slideToggle();
193	});
194
195	/**
196   * アーカイブウィジェット
197   */
198	if ($('.p-dropdown').length) {
199		$('.p-dropdown__title').click(function() {
200			$(this).toggleClass('is-active');
201			$('+ .p-dropdown__list:not(:animated)', this).slideToggle();
202		});
203	}
204
205	/**
206	 * フッターウィジェット
207	 */
208	if ($('#js-footer-widget').length) {
209		var footer_widget_resize_timer;
210		var footer_widget_layout = function(){
211			$('#js-footer-widget .p-widget').filter('.p-footer-widget__left, .p-footer-widget__right, .p-footer-widget__border-left, .p-footer-widget__border-bottom, .widget_nav_menu-neighbor').removeClass('p-footer-widget__left p-footer-widget__right p-footer-widget__border-left p-footer-widget__border-bottom widget_nav_menu-neighbor');
212			if ($('body').width() >= 768) {
213				var em_last, top, em_length = $('#js-footer-widget .p-widget').length;
214				$('#js-footer-widget .p-widget').each(function(i){
215					var pos = $(this).position();
216					if (pos.top !== top) {
217						top = pos.top;
218						$(this).addClass('p-footer-widget__border-bottom');
219						if (pos.left < 2) {
220							$(this).addClass('p-footer-widget__left');
221						}
222						if (em_last) {
223							$(em_last).addClass('p-footer-widget__right');
224						}
225					// メニューの連続
226					} else if (em_last && $(em_last).hasClass('widget_nav_menu') && $(this).hasClass('widget_nav_menu')) {
227						$(this).addClass('widget_nav_menu-neighbor');
228					} else {
229						$(this).addClass('p-footer-widget__border-left');
230					}
231					if (i + 1 == em_length) {
232						$(this).addClass('p-footer-widget__right');
233					}
234					em_last = this;
235				});
236			}
237		};
238		$(window).on('load', footer_widget_layout);
239		$(window).on('resize', function(){
240			clearTimeout(footer_widget_resize_timer);
241			footer_widget_resize_timer = setTimeout(footer_widget_layout, 100);
242		});
243	}
244
245	/**
246	 * リサイズ時parallax.jsの画像ずれ対策
247	 */
248	if (typeof $.fn.parallax == 'function') {
249		var resize__parallax_timer;
250		$(window).on('resize', function(){
251			clearTimeout(resize__parallax_timer);
252			resize__parallax_timer = setTimeout(function(){
253				$(window).trigger('resize.px.parallax');
254			}, 300);
255		});
256	};
257
258});
259
260/**
261 * ヘッダースライダー初期化
262 */
263function init_index_slider(slide_time, responsive) {
264	var $ = jQuery;
265	if (!slide_time) slide_time = 7000;
266
267	var slick_args = {
268		infinite: true,
269		dots: false,
270		arrows: true,
271		prevArrow: '<button type="button" class="slick-prev">&#xe90f;</button>',
272		nextArrow: '<button type="button" class="slick-next">&#xe910;</button>',
273		centerMode: true,
274		centerPadding: '21.7241%',
275		slidesToShow: 1,
276		slidesToScroll: 1,
277		adaptiveHeight: true,
278		autoplay: true,
279		speed: 1000,
280		autoplaySpeed: slide_time
281	};
282
283	if (responsive) {
284		slick_args.responsive = [
285			{
286				breakpoint: 992,
287				settings: {
288					dots: true,
289					centerMode: false
290				}
291			}
292		];
293	}
294
295	$('#js-index-slider').slick(slick_args);
296
297	if (responsive) {
298		// モバイルでスライダー矢印位置を画像中央に、ドットを画像底面に合わせる
299		var set_header_slider_arrow_timer;
300		var set_header_slider_arrow = function(){
301			if ($('body').width() >= 992) {
302				$('#js-index-slider .slick-arrow, #js-index-slider .slick-dots').removeAttr('style');
303			} else {
304				var h = $('#js-index-slider .slick-active img').height();
305				$('#js-index-slider .slick-arrow').css('top', h / 2);
306				$('#js-index-slider .slick-dots').css({
307					top: h - $('#js-index-slider .slick-dots').outerHeight(true) - 12,
308					bottom: 'auto'
309				});
310			}
311		};
312		set_header_slider_arrow();
313		$(window).on('resize orientationchange', function(){
314			clearTimeout(set_header_slider_arrow_timer);
315			set_header_slider_arrow_timer = setTimeout(set_header_slider_arrow, 100);
316		});
317	}
318
319	// adaptiveHeight時parallax.jsの画像ずれ対策
320	if (typeof $.fn.parallax == 'function') {
321		$('#js-index-slider').on('afterChange', function(event, slick, currentSlide){
322			$(window).trigger('resize.px.parallax');
323		});
324	}
325
326}
327
328/**
329 * フッタースライダー初期化
330 */
331function init_footer_slider(slide_time, responsive) {
332	var $ = jQuery;
333	if (!slide_time) slide_time = 7000;
334
335	var slick_args = {
336		infinite: true,
337		dots: false,
338		arrows: true,
339		prevArrow: '<button type="button" class="slick-prev">&#xe90f;</button>',
340		nextArrow: '<button type="button" class="slick-next">&#xe910;</button>',
341		slidesToShow: 3,
342		slidesToScroll: 3,
343		adaptiveHeight: true,
344		autoplay: true,
345		speed: 1000,
346		autoplaySpeed: slide_time
347	};
348
349	if (responsive) {
350		slick_args.responsive = [
351			{
352				breakpoint: 768,
353				settings: {
354					slidesToShow: 2,
355					slidesToScroll: 2
356				}
357			},
358			{
359				breakpoint: 481,
360				settings: {
361					slidesToShow: 1,
362					slidesToScroll: 1
363				}
364			}
365		];
366	}
367
368	$('#js-footer-slider').slick(slick_args);
369
370	if (responsive) {
371		// モバイルでのフッタースライダー位置変更
372		var footer_slider_position = function(){
373			if ($('body').width() >= 768) {
374				if ($('.l-primary #js-footer-blog').length) {
375					$('.l-primary #js-footer-blog').prependTo('.l-footer');
376					$('#js-footer-slider').slick('setPosition');
377				}
378			} else {
379				if ($('.l-footer #js-footer-blog').length) {
380					$('.l-footer #js-footer-blog').appendTo('.l-primary');
381					$('#js-footer-slider').slick('setPosition');
382				}
383			}
384		};
385		footer_slider_position();
386		$(window).on('resize orientationchange', footer_slider_position);
387
388		// モバイルでスライダー矢印位置を画像中央に合わせる
389		var set_footer_slider_arrow_timer;
390		var set_footer_slider_arrow = function(){
391			if ($('body').width() >= 768) {
392				$('#js-footer-slider .slick-arrow').removeAttr('style');
393			} else {
394				$('#js-footer-slider .slick-arrow').css('top', $('#js-footer-slider .slick-active img').height() / 2);
395			}
396		};
397		set_footer_slider_arrow();
398		$(window).on('resize orientationchange', function(){
399			clearTimeout(set_footer_slider_arrow_timer);
400			set_footer_slider_arrow_timer = setTimeout(set_footer_slider_arrow, 100);
401		});
402	}
403}
404

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.