PageSourceSearch

https://www.niandc.co.jp/wp-content/themes/nic/assets/js/scripts.js?v=20260924202241

js niandc.co.jp collected 2026-09-24 11:43:58 UTC 21,159 bytes, 822 lines download raw bytes

1(function ($) {
2
3	$(function () {
4		//aタグ スムーススクロール
5
6		var header = $('.header').innerHeight();
7//		var header = 0;
8		$('a[href*="#"]:not([data-fancybox], .glink ,[href*="#megamenu_"])').click(function () {
9			//console.log($(this));
10			$(this).parents('#menu').each(function () {
11				if ($('#spnav_buttonwrap').css('display') == 'block') {
12					menu_close();
13				}
14			});
15			var speed = 500;
16			var href = '#' + $(this).attr("href").split('#')[1];
17			var target = $(href == "#" || href == "" ? 'html' : href);
18			var position = target.offset().top - header;
19			$('body,html').animate({
20				scrollTop: position
21			}, speed, "swing");
22			return false;
23		});
24
25		var urlHash = location.hash;
26		if(urlHash) {
27				$('body,html').stop().scrollTop(0);
28				setTimeout(function(){
29						var target = $(urlHash);
30						var position = target.offset().top - header - 60;
31						$('body,html').stop().animate({scrollTop:position}, 500);
32				}, 100);
33		}
34
35
36		//スマホメニュー
37		var scroll = 0;
38
39		function menu_open() {
40			scroll = $(window).scrollTop();
41			var wrapperTop = $('#wrapper').offset().top;
42			$('body').addClass('menu_active');
43			$('body').data('menu', 'menu_active');
44			var positionTop = wrapperTop - scroll;
45			$('body.menu_active #wrapper').css({
46				'top': positionTop + 'px',
47				'position': 'fixed',
48				'left': '0px',
49				'right': '0px',
50			});
51		}
52
53		function menu_close() {
54			$('body').removeClass('menu_active');
55			$('body #wrapper').css({
56				'position': 'static',
57			});
58			$(window).scrollTop(scroll);
59			$("#spnav_buttonwrap").removeClass("open");
60			$('#spgnavi').removeClass("open");
61			$('#spnav_button').removeClass('on');
62		}
63
64
65		$('#menu').on('click', '.btn_menu_open', function () {
66			menu_open();
67			return false;
68		});
69		$('#menu').on('click', '.btn_menu_close', function () {
70			menu_close();
71			return false;
72		});
73		$('.menu_filter').on('click', function () {
74			menu_close();
75			return false;
76		});
77		$('#spnav_button').click(function () {
78			$("#spnav_buttonwrap").toggleClass("open");
79			$('#spgnavi').toggleClass("open");
80			$(this).toggleClass('on');
81			$(".overlay").fadeToggle();
82
83			if ($('body').hasClass('menu_active')) {
84				menu_close();
85			} else {
86				menu_open();
87			}
88			return false;
89		});
90
91
92
93		// nav-current 2024/08/19 追加
94		const path = window.location.pathname;
95
96		// ニュース
97		if (path.startsWith('/news/') ||
98				path.startsWith('/category/')) {
99			$('#menu-item-25082').addClass('current-menu-item');
100		};
101
102		// FAQ
103		if (path.startsWith('/faq_cat/')) {
104			$('#menu-item-44992').addClass('current-menu-item');
105		};
106
107		// 障害情報
108		if (path.startsWith('/trouble/')) {
109			$('#menu-item-55538').addClass('current-menu-item');
110		};
111
112		// ソリューション
113		if (path.startsWith('/solution/') ||
114				path.startsWith('/sol_cat/') ||
115				path.startsWith('/sol/') ||
116				path.startsWith('/sol_problem/') ||
117				path.startsWith('/sol_tag/')) {
118			$('#menu-item-1544').addClass('current-menu-item');
119		};
120
121		// 導入事例
122		if (path.startsWith('/examples/') ||
123				path.startsWith('/examples_industry/') ||
124				path.startsWith('/examples_cat/')) {
125			$('#menu-item-25081').addClass('current-menu-item');
126		};
127
128		// セミナー&イベント
129		if (path.startsWith('/seminar/') ||
130				path.startsWith('/seminar_cat/')) {
131			$('#menu-item-990').addClass('current-menu-item');
132		};
133
134		// Tech Blog
135		if (path.startsWith('/tech/') ||
136				path.startsWith('/tech_sol/') ||
137				path.startsWith('/tech_cat/') ||
138				path.startsWith('/tech_tag/')) {
139			$('#menu-item-991').addClass('current-menu-item');
140		};
141
142		// 企業情報
143		if (path.startsWith('/company/')) {
144			$('#menu-item-1545').addClass('current-menu-item');
145		};
146
147		// サステナビリティ
148		if (path.startsWith('/sustainability/')) {
149			$('#menu-item-1546').addClass('current-menu-item');
150		};
151
152		// 採用情報(ニュース)
153		if (path.startsWith('/recruitment/recruit_info/') ||
154				path.startsWith('/recruit_info_cat/')) {
155			$('#menu-item-1041').addClass('current-menu-item');
156		};
157
158		// 採用情報(メッセージ)
159		if (path.startsWith('/recruitment/message/')) {
160			$('#menu-item-1039').addClass('current-menu-item');
161		};
162
163		// 採用情報(会社を知る)
164		if (path.startsWith('/recruitment/about/')) {
165			$('#menu-item-1038').addClass('current-menu-item');
166		};
167
168		// 採用情報(人を知る)
169		if (path.startsWith('/recruitment/people/')) {
170			$('#menu-item-1042').addClass('current-menu-item');
171		};
172
173		// 採用情報(キャリア・研修制度)
174		if (path.startsWith('/recruitment/training/')) {
175			$('#menu-item-1077').addClass('current-menu-item');
176		};
177
178		// 採用情報(ワークスタイル)
179		if (path.startsWith('/recruitment/work-style/')) {
180			$('#menu-item-1076').addClass('current-menu-item');
181		};
182
183		// 採用情報(採用情報)
184		if (path.startsWith('/recruitment/recruit/')) {
185			$('#menu-item-1075').addClass('current-menu-item');
186		};
187
188		// 採用情報(お問い合わせ)
189		if (path.startsWith('/recruitment/recruit_contact/')) {
190			$('#menu-item-1074').addClass('current-menu-item');
191		};
192
193	});
194
195
196	//スライダー
197	$(function () {
198		$('.top_slider').each(function () {
199			$(this).slick({
200				autoplay: false, // 2025/05/07 一旦オートプレイを停止
201				autoplaySpeed: 4000,
202				speed: 3000,
203				dots: true,
204				arrows: false,
205				fade: true,
206			});
207		});
208	});
209
210
211	//fancybox
212	$(function () {
213		$('[data-fancybox]').fancybox({
214			loop: true,
215		});
216		$('a[href$=".jpg"],a[href$=".png"]').fancybox();
217	});
218
219
220	//ローディング
221	$(window).load(function () {
222		$('body').addClass('loaded');
223		setTimeout(function () {
224			effect();
225		}, 1000);
226	});
227
228
229	// セレクトボックス選択でページ遷移
230	$('.select_link').on('change', function () {
231		// 遷移先URL取得
232		var url = $(this).val();
233		// URLが取得できていればページ遷移
234		if (url != '') {
235			location.href = url;
236		}
237	});
238
239
240	//ヘッダー
241	$(window).on('scroll load', function () {
242		$('.header').each(function () {
243			var scroll = $(window).scrollTop();
244			var wrapperTop = $('#wrapper').offset().top;
245			if (scroll >= 200 || wrapperTop >= 200) {
246				$(this).addClass('is_active');
247			} else {
248				$(this).removeClass('is_active');
249			}
250		});
251	});
252
253
254	//accordion
255	$(function () {
256		//$(".accordion dd").hide();
257		$(".accordion dt").click(function () {
258			var $btn = $(this);
259			var $parent = $btn.closest('.accordion');
260			$parent.find("dd").slideToggle();
261			$parent.find("dd").siblings("dd").slideUp();
262			if ($parent.hasClass('open')) {
263				$parent.removeClass('open');
264			} else {
265				$parent.addClass('open');
266			}
267		});
268	});
269
270
271	//totop
272	$(window).on('scroll load', function () {
273		$('.totop').each(function () {
274			var psition = $('.totop').offset().top + $('.totop').outerHeight();
275			var scroll = $(window).scrollTop();
276			var windowHeight = $(window).height();
277			var solutionBtn = $('.solution_float_btn');
278			var hasSolutionBtn = solutionBtn.length > 0;
279
280			if (scroll >= 200) {
281				$('.totop a').addClass('show');
282			} else {
283				$('.totop a').removeClass('show');
284			}
285
286			if (hasSolutionBtn) {
287				if (scroll >= 1) {
288					$('.solution_float_btn').addClass('show');
289				} else {
290					$('.solution_float_btn').removeClass('show');
291				}
292			}
293
294			if (scroll >= psition - windowHeight) {
295				$('.totop a').addClass('bottom');
296				if (hasSolutionBtn) {
297					$('.solution_float_btn').removeClass('show');
298				}
299			} else {
300				$('.totop a').removeClass('bottom');
301			}
302
303			if (psition <= windowHeight + 200) {
304				$('.totop a').addClass('show').addClass('bottom');
305			}
306		});
307	});
308
309
310	//動くアイコン
311	$(window).on('load scroll', function () {
312		effect();
313	});
314
315	function effect() {
316		var prevPos = 0;
317		var i = 0;
318		$('.effect').each(function () {
319			var imgPos = $(this).offset().top;
320			var scroll = $(window).scrollTop();
321			var windowHeight = $(window).height();
322
323			if (scroll > imgPos - windowHeight + windowHeight / 15) {
324				if (imgPos == prevPos) {
325					i++;
326				} else {
327					i = 0;
328				}
329				$(this).delay(i * 200).queue(function (next) {
330					$(this).addClass('active');
331					next();
332				});
333				prevPos = imgPos;
334			}
335		});
336
337		$('.effect_group_wrap').each(function () {
338			var imgPos = $(this).offset().top;
339			var scroll = $(window).scrollTop();
340			var windowHeight = $(window).height();
341
342			if (scroll > imgPos - windowHeight + windowHeight / 15) {
343				$(this).find('.effect_group').each(function (i) {
344					if ($(this).hasClass('effect_fast')) {
345						$(this).delay(i * 200).queue(function (next) {
346							$(this).addClass('active');
347							next();
348						});
349					} else {
350						$(this).delay(i * 400).queue(function (next) {
351							$(this).addClass('active');
352							next();
353						});
354					}
355				});
356			}
357		});
358	}
359
360
361	//カテゴリアコーディオン
362	$('.open_category_block').on('click', function () {
363		var $btn = $(this);
364		var $parent = $btn.parents('.header_category_block');
365		var target = $(this).data('target');
366		//var $child = $parent.find('.header_child_category_block');
367
368		if ($(target).hasClass('show')) {
369			product_search_close();
370		} else {
371			product_search_close();
372			$btn.addClass('active');
373			$parent.parents('.pulldown_block').addClass('is_open');
374			$(target).addClass('show');
375		}
376	});
377
378	function product_search_close() {
379		$('.open_category_block').removeClass('active');
380		$('.header_child_category_block').removeClass('show');
381		$('.pulldown_block').removeClass('is_open');
382	}
383
384	$('.pulldown_filter').on('click', function () {
385		product_search_close();
386	});
387
388	//スマホカテゴリ
389	$('.category_group_btn').on('click', function () {
390		var $btn = $(this);
391		var $parent = $btn.parents('.pulldown_block');
392		var target = $parent.find('.header_category_block');
393		if ($(target).hasClass('show')) {
394			//product_search_close();
395		} else {
396			//product_search_close();
397			$(target).addClass('show');
398		}
399	});
400	$('.pulldown_close').on('click', function () {
401		product_search_close();
402		$('.header_category_block').removeClass('show');
403	});
404
405
406	//faq
407	$('.faq_list dl.faq_box').each(function(){
408		$(this).children('dd').hide();
409	});
410	$('.faq_list dl.faq_box dt').on('click', function () {
411		var $this = $(this);
412		var $parent = $this.parent('dl');
413
414		var $wrapper = $this.closest('.faq_list');
415		$wrapper.find('dl').not($parent).removeClass('active');
416		$wrapper.find('dl').not($parent).children('dd').slideUp('active');
417
418		$parent.toggleClass('active');
419		$parent.children('dd').slideToggle('active');
420	});
421
422	//交通アクセス
423	$('.open_btn').on('click', function () {
424		var target = $(this).data('target');
425		$(this).parents('section').find('.open_btn').each(function () {
426			$(this).removeClass('active');
427		})
428		$(this).parents('section').find('.access_content').each(function () {
429			$(this).removeClass('open');
430		})
431		$(this).addClass('active');
432		$(target).addClass('open');
433	});
434
435
436	$('.js-scrollable').each(function(){
437		new ScrollHint('.js-scrollable', {
438			i18n: {
439				scrollable: 'スクロールできます'
440			}
441		});
442	});
443
444
445
446	// カテゴリー検索
447
448//		var dataBox = [],
449//			$grid = $('#animationList'),
450//			item = '.item_list .box';
451
452
453	var scroll = 0;
454
455		function tabClose(){
456			$('.tag_group dl').removeClass('active').find('dd').hide();
457			$('.pulldown_filter').removeClass('is_open');
458			//$('body').removeClass('tab_active');
459			$('body #wrapper').css({
460				'position': 'static',
461			});
462			$(window).scrollTop(scroll);
463			$('body').removeClass('tag_open');
464		}
465
466		$('.tag_group_btn').on('click',function(){
467			scroll = $(window).scrollTop();
468			var wrapperTop = $('#wrapper').offset().top;
469
470			//$('body').addClass('tab_active');
471			var positionTop = wrapperTop - scroll;
472			$('body #wrapper').css({
473				'top': positionTop + 'px',
474				'position': 'fixed',
475				'left': '0px',
476				'right': '0px',
477			});
478			$('body').addClass('tag_open');
479
480			var $this = $(this);
481			var $parent = $this.parents('dl');
482			//var contentHeight = $parent.find('.tag_content_inner').outerHeight(true);
483			var is_active = $parent.hasClass('active');
484			//var tag_label = $parent.find('.tag_label').text();
485			//$this.text(tag_label).removeClass('selected');
486//			tabClose();
487			if(!is_active){
488				$parent.addClass('active').find('dd').fadeIn();
489				$('.pulldown_filter').addClass('is_open');
490			}
491//			var data = $this.data();
492//			var key = Object.keys(data);
493//			delete dataBox[key];
494		});
495
496		$('.pulldown_filter').on('click',function(){
497			tabClose();
498		});
499
500		$('.tabClose_btn').on('click',function(){
501			tabClose();
502		});
503
504
505  $('.tag_search_text').keyup(function(){
506    var search = $(this).val();
507    var taxonomy = $(this).data('taxonomy');
508		var number = 0;
509		ajax_search(search,taxonomy,number);
510  });
511
512  function ajax_search(search,taxonomy){
513		$.ajax({
514				type: "GET",
515				url: ajaxurl,
516				data: {
517					'action': 'view_mes',
518					'search': search,
519          'taxonomy': taxonomy,
520				},
521			}).done(function (data) {
522				$('#tag_search_result').html(data);
523
524			var frame_height_base = 200;
525			var $frame = $('.readmore');
526			var $more_btn = $frame.find('.side_tag_more').find('.side_tag_more_btn');
527			var tag_heght = $('.readmore-content').outerHeight()+$frame.find('.side_tag_more').outerHeight();
528
529      if(!$frame.hasClass('open')){
530//        $frame.removeClass('open');
531				if(tag_heght > frame_height_base){
532					$more_btn.show();
533				}else{
534					$more_btn.hide();
535				}
536				tag_heght = $('.readmore-content').outerHeight()+$frame.find('.side_tag_more').outerHeight();
537        $frame.height(frame_height_base);
538      }else{
539//        $frame.addClass('open');
540				if(tag_heght < frame_height_base){
541					$more_btn.hide();
542				}else{
543					$more_btn.show();
544				}
545				tag_heght = $('.readmore-content').outerHeight()+$frame.find('.side_tag_more').outerHeight();
546        $frame.height(tag_heght);
547      }
548
549//			if(tag_heght > frame_height_base){
550//				$frame.height(frame_height_base);
551//				$more_btn.show();
552//				$frame.removeClass('open');
553//			}else{
554//				$frame.height(tag_heght);
555//				$more_btn.hide();
556//				$frame.addClass('open');
557//			}
558
559			});
560  }
561
562	//メガメニュー
563
564			$('.gnav_list .has_megamenu a').each(function(){
565				var target = $(this).attr('href');
566				$(target).appendTo($(this).parent('li'));
567			});
568
569//	$(window).on('load scroll',function(){
570//		if($(this).width() <= 768){
571//			$('.has_megamenu a').each(function(){
572//				var target = $(this).attr('href');
573//				$(target).appendTo($(this).parent('li'));
574//			});
575//			$('.megamenu_content').hide();
576//		}else{
577//
578//		}
579//	});
580
581	$('.gnav_list .has_megamenu a').on('click',function(){
582		var target = $(this).attr('href');
583//		if ($(window).width() <= 768) {
584//			$(target).slideToggle(200);
585//		} else {
586//			if ($(this).parent('li').hasClass('active')) {
587//				$('.has_megamenu').removeClass('active');
588//				$('.megamenu_content').removeClass('open');
589//			} else {
590//				$('.has_megamenu').removeClass('active');
591//				$('.megamenu_content').removeClass('open');
592//				$(this).parent('li').addClass('active');
593//				$(target).addClass('open');
594//			}
595//		}
596            if ($(this).parent('li').hasClass('active')) {
597				$(this).parent('li').removeClass('active');
598				$(target).removeClass('open');
599				$(target).removeClass('open_sp');
600            } else {
601                $('.has_megamenu').removeClass('active');
602                $('.megamenu_content').removeClass('open');
603                $('.megamenu_content').removeClass('open_sp');
604                $(this).parent('li').addClass('active');
605                $(target).addClass('open');
606                $(target).addClass('open_sp');
607            }
608		return false;
609	});
610
611
612  //サイトバー タグ アコーディオン
613  $('.readmore').each(function(){
614    var frame_height_base = 200;
615    var $frame = $('.readmore');
616		var $more_btn = $frame.find('.side_tag_more').find('.side_tag_more_btn');
617
618		if(!$('.tag_group_btn').length){
619			var tag_heght = $('.readmore-content').outerHeight()+$frame.find('.side_tag_more').outerHeight();
620			if(tag_heght > frame_height_base){
621				$frame.height(frame_height_base);
622			}else{
623				$more_btn.hide();
624			}
625		}
626
627		$('.tag_group_btn').on('click',function(){
628			var tag_heght = $('.readmore-content').outerHeight()+$frame.find('.side_tag_more').outerHeight();
629			if(tag_heght > frame_height_base){
630				$frame.height(frame_height_base);
631			}else{
632				$more_btn.hide();
633			}
634		});
635
636    $more_btn.on('click',function(){
637			var tag_heght = $('.readmore-content').outerHeight()+$frame.find('.side_tag_more').outerHeight();
638      if($frame.hasClass('open')){
639        $frame.height(frame_height_base);
640        $frame.removeClass('open');
641      }else{
642        $frame.height(tag_heght);
643        $frame.addClass('open');
644      }
645      return false;
646    });
647  });
648
649
650  //タグ アコーディオン
651//  $('.readmore-content').each(function(){
652//    var frame_height_base = 200;
653//    var $frame = $(this).parent('.readmore');
654//    var tag_heght = $(this).outerHeight()+$frame.find('.readmore_more').outerHeight();
655//    $frame.height(frame_height_base);
656//    $frame.find('.readmore_more').find('.readmore_more_btn').on('click',function(){
657//      if($frame.hasClass('open')){
658//        $frame.height(frame_height_base);
659//        $frame.removeClass('open');
660//      }else{
661//        $frame.height(tag_heght);
662//        $frame.addClass('open');
663//      }
664//      return false;
665//    });
666//  });
667
668
669
670	//TOP NEWS tab
671	$('.top_news_tab_label').eq(0).addClass('active');
672	$('.top_news_content').eq(0).addClass('open');
673  $('.top_news_tab_label').on('click',function(){
674		var target = $(this).data('target');
675		$('.top_news_content').removeClass('open');
676		$(target).addClass('open');
677		$('.top_news_tab_label').removeClass('active');
678		$(this).addClass('active');
679	});
680
681
682
683
684	//フォームの調整
685	$(window).on('load', function () {
686		$('[name=your-solution]').each(function(){
687			if($('[name=your-division]').val() =='製品・サービス'){
688				$('.branch').addClass('active');
689				$('[name=your-solution]').prop('disabled', false);
690			}else{
691				$('.branch').removeClass('active');
692				$('[name=your-solution]').prop('disabled', true);
693			}
694		});
695	});
696
697	$('select[name=your-division]').on('change', function(){
698			var select_val = $(this).val();
699			if(select_val =='製品・サービス'){
700				$('.branch').addClass('active');
701				$('select[name=your-solution]').prop('disabled', false);
702			}else{
703				$('.branch').removeClass('active');
704				$('select[name=your-solution]').prop('disabled', true);
705			}
706	});
707
708
709
710	///フォームの全角を半角に変換
711	$(function(){
712    $("input.keyword").blur(function(){
713			charChange($(this));
714    });
715
716		charChange = function(e){
717        var val = e.val();
718        var str = val.replace(/[A-Za-z0-9]/g,function(s){return String.fromCharCode(s.charCodeAt(0)-0xFEE0)});
719
720        if(val.match(/[A-Za-z0-9]/g)){
721            $(e).val(str);
722        }
723			}
724
725//    $("input.tel_validation").blur(function(){
726    $("input#your-tel").blur(function(){
727			telChange($(this));
728    });
729
730		telChange = function(e){
731        var val = e.val();
732        var str = val.replace(/[\-]/g,'').replace(/ー/g,'').replace(/\s+/g,'');
733        if(val.match(/[\-]|ー|\s+/g)){
734            $(e).val(str);
735        }
736			}
737	});
738
739	//コピー&ペースト禁止
740	$(function(){
741		$('.noCopy').on('copy cut',function(e){
742			e.preventDefault();
743		});
744
745		$('.noPaste').on('paste',function(e){
746			e.preventDefault();
747		});
748	});
749
750	//セレクトボックスのvalueが空白のときクラスに「is-empty」を追加
751	$(function(){
752		const Target = $('select#your-division');
753		$(window).on('load',function(){
754			$(Target).each(function(){
755				if ($(this).val() !== ""){
756					$(this).removeClass('is-empty');
757				} else {
758					$(this).addClass('is-empty');
759				}
760			});
761		});
762		$(Target).on('change', function(){
763			if ($(this).val() !== ""){
764				$(this).removeClass('is-empty');
765			} else {
766				$(this).addClass('is-empty');
767			}
768		});
769	});
770
771
772	//SPローカルナビMENU
773	$('.local_nav_menu_btn').on('click',function(){
774		$('.local_nav_menu + .container').slideToggle();
775	});
776
777	//一覧表示切り替え
778	var params = (new URL(document.location)).searchParams;
779	var display = params.get('display');
780
781
782	if ($('#sol_list_section').length) {
783		if(display == 'grid'){
784			$('.switch_btn_grid').addClass('cur');
785			$('.switch_list').removeClass('search_list');
786		}else{
787			$('.switch_btn_list').addClass('cur');
788			$('.switch_list').addClass('search_list');
789		}
790	} else {
791		if(display == 'list'){
792			$('.switch_btn_list').addClass('cur');
793			$('.switch_list').addClass('search_list');
794		}else{
795			$('.switch_btn_grid').addClass('cur');
796			$('.switch_list').removeClass('search_list');
797		}
798	};
799
800	$('.switch_btn > *').on('click',function(){
801		$('.switch_btn > *').removeClass('cur');
802		$(this).addClass('cur');
803		var display = $(this).data('display');
804		if(display == 'list'){
805			$('.switch_list').addClass('search_list');
806		}else{
807			$('.switch_list').removeClass('search_list');
808		}
809		return false;
810	});
811
812
813	//aタグの中にimgタグがあるかどうか
814	$('a[target="_blank"]').find('img').each(function(){
815		$(this).parents('a').addClass('has_img');
816	});
817
818
819
820})(jQuery);
821
822

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.