PageSourceSearch

https://www.jrfreight.co.jp/library/js/front/js/script.js

js jrfreight.co.jp collected 2026-10-02 14:57:02 UTC 5,939 bytes, 210 lines download raw bytes

1
2function scroll() {
3    $('a[href^="#"]').click(function(){
4        var href= $(this).attr("href");
5        var target = $(href == "#" || href == "" ? 'html' : href);
6        var position = target.offset().top;
7        $('html, body').stop().animate({ scrollTop: position }, 500, 'swing');
8        return false;
9    });
10}
11
12function showSubnavOnMobile(targetID) {
13	if ($(targetID).attr('data-target')) {
14		var target = '#' + $(targetID).attr('data-target');
15		$(target).slideToggle('slow');
16
17	} else {
18		var target = $(targetID).attr('href');
19		window.location.href = target;
20	}
21
22	if (!($(targetID).closest('li').hasClass('subnav_container'))) {
23		if ($('.main_nav').css('display') == 'block') {
24			if ($('body').hasClass('lock')) {
25				$('body').removeClass('lock');
26				$(this).closest('li').css({'z-index' : '1'})
27			} else {
28				$('body').addClass('lock');
29				$(this).closest('li').css({'z-index' : '4'})
30			}
31		} 
32	}
33}
34
35function showSubnav(targetID) {
36
37    if ($(targetID).hasClass('hoversub')) {
38		if ($(targetID).attr('data-target')) {
39			var target = '#' + $(targetID).attr('data-target');
40			if (!($(target).hasClass('open'))) {
41				$('.subnav').removeClass('open');
42				$(target).addClass('open');
43			} else {
44				$('.subnav').removeClass('open');
45			}
46		}
47	} else {
48		if (!($(targetID).hasClass('subnav_item'))) {
49			$('.subnav').removeClass('open');
50		}
51
52	}
53}
54
55function initSliders() {
56	var topSwiper = new Swiper('.top__kv_swiper', {
57      	navigation: {
58        	nextEl: '.swiper__next',
59        	prevEl: '.swiper__prev',
60      	},
61      	pagination: {
62	        el: '.swiper-pagination',
63	    },
64	    autoplay: {
65		    delay: 6000,
66		},
67		loop: true
68    });
69}
70
71function topPageLoad() {
72	if ($('.kv_play').length) {
73		$('.header__content').on('load', function() {
74
75			$('.preloader--full').fadeOut('slow');
76			scroll();
77		})
78	}
79}
80
81$(function(){
82	initSliders();
83	scroll();
84	topPageLoad();
85}); // ready
86
87$(window).on('load', function(){
88	$('.preloader--full').fadeOut('slow');
89	scroll();
90}); // load
91
92$(function(){
93	if($('.pc').css('display') == 'block'){
94		$('.main_nav').addClass('pc_layout');
95	    $('.main_nav').removeClass('sp_layout');
96	}else if($('.sp').css('display') == 'block') {
97        $('.main_nav').addClass('sp_layout');
98		$('.main_nav').removeClass('pc_layout');
99	}
100
101	$('nav li a').on('mouseover', function(e) {
102        	e.preventDefault();
103        	if($('.pc').css('display') == 'block'){
104        	    showSubnav(this);
105        	}
106	});
107	$('.subnav').mouseleave(function(e) {
108		e.preventDefault();
109		if($('.pc').css('display') == 'block'){
110		    $(this).removeClass('open');
111		}
112	});
113
114	// show search
115	$('a[data-target="searchform"]').on('click', function() {
116		if($('.pc').css('display') == 'block'){
117			if ($('.searchform').css('display') == 'none') {
118				$('.searchform').css({'display' : 'block'});
119			} else {
120				$('.searchform').css({'display' : 'none'});
121			}
122		}
123	});
124	
125	$('nav li a').on('click', function(e) {
126		if($('.sp').css('display') == 'block'){
127			e.preventDefault();
128			showSubnavOnMobile(this);
129		}
130	});
131});
132
133$(window).on('resize', function(){
134	if($('.pc').css('display') == 'block'){
135		$('.main_nav').addClass('pc_layout');
136	    $('.main_nav').removeClass('sp_layout');
137	}else if($('.sp').css('display') == 'block') {
138        $('.main_nav').addClass('sp_layout');
139		$('.main_nav').removeClass('pc_layout');
140	}
141}); // resize
142
143
144jQuery(function($) {
145
146  // PAGE
147  if (typeof pbPageEditParams == 'undefined' || pbPageEditParams['statusFlag'] != 1) {
148  	var maxHeight = 0;
149  	$('.base_en-financials table').each(function(){
150  	  if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
151  	});
152  	$('.base_en-financials table').height(maxHeight);
153  } else {
154    $('.pbPage').addClass('edit');
155  }
156
157  // SWITCHING
158  $('.latestinfo__tabs li:first-child,.latestinfo__panel > div > div:first-child').addClass('active');
159  $('.latestinfo__tabs li').on('click', function(){
160    var index = $(this).parent('ul').find('li').index(this);
161    $(this).addClass('active').siblings().removeClass('active');
162    $('.latestinfo__panel > div > div').removeClass('active').eq(index).addClass('active');
163  });
164
165  // DROPDOWN
166  $('.latestinfo__dropdown .button').on('click', function(){
167  	$(this).parent('.latestinfo__dropdown').stop(true,true).toggleClass('active');
168  	$(this).next('ul').stop(true,true).slideToggle();
169  });
170
171  // ACCORDION
172  $('.base_accordion .title').on('click', function(){
173  	$(this).next('.textbox').stop(true,true).slideToggle();
174  });
175
176  // IMG
177  objectFitImages();
178
179});
180
181$(function() {
182
183  // MORE(voice 改修)
184  $('.more-height').each(function(){
185    var contentHeight = $('.content',this).outerHeight();
186    if(contentHeight > 67){
187      $(this).parents('.base_voice .box .textbox').find('.more-height .text.-summary').addClass('omission');
188      $('.content',this).height('67px');
189    } else {
190      $(this).addClass('auto');
191    }
192  });
193  $('.more-height .more-btn a.open').on('click', function(){
194    $(this).parents('.base_voice .box .textbox').find('.more-height .text.-summary').removeClass('omission');
195    var contentHeight = $(this).parents('.more-height').find('.content').get(0).scrollHeight;
196    $(this).parents('.more-height').toggleClass('active').find('.content').height(contentHeight);
197  });
198  $('.more-height .more-btn a.close').on('click', function(){
199    $(this).parents('.more-height').toggleClass('active').find('.content').height('67px');
200    $(this).parents('.base_voice .box .textbox').find('.more-height .text.-summary').addClass('omission');
201  });
202
203  // DE&I(Diversity, Equity and Inclusion)モーダル
204  if($('.js-modal_image')[0]){
205	  $('.js-modal_image a').magnificPopup({
206		type: 'image',
207		mainClass: 'mfp-fade'
208	});
209  }
210});

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.