PageSourceSearch

https://www.bridgestone.co.jp/common/js/framework.js

js bridgestone.co.jp collected 2026-10-02 03:16:59 UTC 7,098 bytes, 225 lines download raw bytes

1/**
2 * framework.js
3 * (PC版用)
4 */
5
6
7/* !stack ------------------------------------------------------------------- */
8jQuery(document).ready(function($) {
9	gnavi();
10	dropdownMenu();
11	pagetop();
12	pageScroll();
13    headerFix();
14});
15
16
17/* !gNavi
18--------------------------------------------------- */
19var gnavi = function() {
20	$(window).on('DOMContentLoaded', function() {
21		$('#gNavi ul li').removeClass('current');
22		var pathArr = location.pathname.split("/");
23		if( pathArr[1] != "" ) {
24			$('#gNavi ul li.' + pathArr[1]).addClass('current');
25		}
26	});
27};
28/* !dropdownMenu
29--------------------------------------------------- */
30var dropdownMenu = function(){
31	$(window).on('DOMContentLoaded', function() { dropdownMenu_pc(); });
32	
33	// メニューの挙動を定義
34	var dropdownMenu_pc = function() {
35		var dutation = 500;
36		var dropMenu_animation_timeout = null;
37
38		// Gナビ
39		$('#gNavi ul li:not(.is-inactive)').on({
40			'mouseenter': function() {
41				clearTimeout(dropMenu_animation_timeout);
42
43				// 開いているメニューがない場合 → メニュー開く(スライドダウン)
44				if( $('#gNavi ul li.active').size() == 0 ) {
45					$(this).addClass('active');
46					var id = $(this).attr('id').replace('gNav', '');
47					$('#dropMenu > li').fadeTo(1, 0).hide();
48					$('#dropMenu #menu'+id).show().fadeTo(dutation, 1);
49					$('#dropMenu').slideDown('fast');
50					
51				// 開いているメニューがある場合
52				} else {
53					// 他のメニューがクリックされた場合 → コンテンツのみ切替
54					if( !$(this).hasClass('active') ) {
55						$('#gNavi ul li').removeClass('active');
56						$(this).addClass('active');
57						var id = $(this).attr('id').replace('gNav', '');
58						$('#dropMenu > li').fadeTo(1, 0).hide();
59						$('#dropMenu #menu'+id).show().fadeTo(dutation, 1);
60					}
61				}
62				return false;
63			},
64			'mouseleave': function() {
65				clearTimeout(dropMenu_animation_timeout);
66				dropMenu_animation_timeout = setTimeout(function(){
67					$('#gNavi ul li').removeClass('active');
68					$('#dropMenu').slideUp('fast');
69				}, 150);
70			}
71		});
72		$('#searchNav-btn').on('click', function(e){
73			e.preventDefault();
74			$('.headerSearch-wrap').slideToggle('fast');
75		})
76		$('.headerSearch-close').on('click', function(e){
77			e.preventDefault();
78			$('.headerSearch-wrap').slideToggle('fast');
79		})
80
81		$('#dropMenuWrap').on({
82			'mouseenter': function() {
83				clearTimeout(dropMenu_animation_timeout);
84			},
85			'mouseleave': function() {
86				clearTimeout(dropMenu_animation_timeout);
87				dropMenu_animation_timeout = setTimeout(function(){
88					$('#gNavi ul li').removeClass('active');
89					$('#dropMenu').slideUp('fast');
90				}, 150);
91			}
92		});
93		
94		// 閉じるボタンまたはヘッダ以外クリック → メニュー閉じる(スライドアップ)
95		// $('.dropMenuHeader01 .close, body > *:not(#header)').on('click.close_click', function() {
96		// 	$('#gNavi ul li').removeClass('active');
97		// 	$('#dropMenu').slideUp('fast');
98		// });
99	}
100}
101
102/* !pagetop
103--------------------------------------------------- */
104var pagetop = function() {
105	$(window).on('load scroll', function() {
106		if( $(window).scrollTop() > 100) {
107			$('.pageTop').fadeIn();			
108		} else {
109			$('.pageTop').fadeOut();
110		}
111	});	
112};
113
114/* !isUA
115-------------------------------------------------------------------- */
116var isUA = (function(){
117	var ua = navigator.userAgent.toLowerCase();
118	indexOfKey = function(key){ return (ua.indexOf(key) != -1)? true: false;}
119	var o = {};
120	o.ie      = function(){ return indexOfKey("msie"); }
121	o.fx      = function(){ return indexOfKey("firefox"); }
122	o.chrome  = function(){ return indexOfKey("chrome"); }
123	o.opera   = function(){ return indexOfKey("opera"); }
124	o.android = function(){ return indexOfKey("android"); }
125	o.ipad    = function(){ return indexOfKey("ipad"); }
126	o.ipod    = function(){ return indexOfKey("ipod"); }
127	o.iphone  = function(){ return indexOfKey("iphone"); }
128	return o;
129})();
130
131/* !pageScroll
132--------------------------------------------------- */
133var pageScroll = function(){
134	jQuery.easing.easeInOutCubic = function (x, t, b, c, d) {
135		if ((t/=d/2) < 1) return c/2*t*t*t + b;
136		return c/2*((t-=2)*t*t + 2) + b;
137	};
138	$('a.scroll, .scroll a, .pageTop a, area.scroll').each(function(){
139		$(this).bind("click keypress",function(e){
140			e.preventDefault();
141			var target  = $(this).attr('href');
142			var targetY = $(target).offset().top;
143			var parent  = ( isUA.opera() )? (document.compatMode == 'BackCompat') ? 'body': 'html' : 'html,body';
144      if(target == '#header'){
145        $(parent).animate(
146          {scrollTop: 0 },
147          400,
148          'easeInOutCubic'
149        );
150      } else {
151		if( $(document).width() < 980 ) {
152            var headerHeight = $('#header').height();
153        } else {
154            var headerHeight = 50;
155        }
156        $(parent).animate(
157          {scrollTop: targetY-headerHeight },
158          400,
159          'easeInOutCubic'
160        );
161      }
162			return false;
163		});
164	});
165}
166
167/* !headerFix
168--------------------------------------------------- */
169var headerFix = function(){
170
171    var target = $('#header');
172    var targetSearch = $('#headerSearch');
173    var targetWrapper = $('#wrapper');
174
175    // $('#headerContentIn').append('<a href="#" class="js-search-trigger-rw"></a>');
176
177    $(window).on('DOMContentLoaded resize', function() {
178		var headerHeight = target.innerHeight();
179        if($(document).width() >= 980 ) {
180            target.removeClass('is-rw');
181             // scroll event
182            $(window).on('load scroll', function() {
183                if ($(this).scrollTop() > headerHeight) {
184                    target.addClass('is-fixed');
185                    $('body').css('padding-top',headerHeight);
186                    target.stop().animate({
187                        'top': '0'
188                    },'fast');
189                } else if($(this).scrollTop() <= headerHeight) {
190					if(!target.hasClass('minHeader')){
191						target.removeClass('is-fixed').removeAttr('style','top')
192					}
193                    $('body').css('padding-top',0);
194                }
195            });
196            if ($(this).scrollTop() > headerHeight) {
197
198            } else if($(this).scrollTop() <= headerHeight) {
199                $('body').css('padding-top',0);
200            }
201        // TB以下
202        } else {
203            target.addClass('is-rw');
204            $('body').css('padding-top',headerHeight);
205              // scroll event
206            $(window).on('scroll', function() {
207                $('body').css('padding-top',headerHeight);
208            });
209        }
210    });
211
212    
213
214    // menu
215    // $(document).on('click', '#headerMenuBtn', function() {
216    //     if($(this).hasClass('open')){
217    //         $('.js-search-trigger-rw').hide();
218    //     } else {
219    //         $('.js-search-trigger-rw').show();
220    //     }
221    //     return false;
222    // });
223
224
225 }

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.