PageSourceSearch

https://www.towa-sports.co.jp/wp-content/themes/towa-sports/assets/js/shared.js

js towa-sports.co.jp collected 2026-10-02 22:17:34 UTC 7,162 bytes, 249 lines download raw bytes

1/*!
2 * ScriptName: shared.js
3 *
4 */
5
6/* hamburger
7=============================================*/
8$(function() {
9   $('body').removeClass('navOpen');
10   $(".hamburger").click(function() {
11      if ($('body').hasClass('navOpen')) {
12         $('body').addClass('navClose');
13         $('body').removeClass('navOpen');
14         $('body').css('position', 'static');
15         $(window).scrollTop(offsetY);
16         $(".hamburger").removeClass('is-active');
17      } else {
18         $('body').addClass('navOpen');
19         $('body').removeClass('navClose');
20         $(".hamburger").addClass('is-active');
21         offsetY = window.pageYOffset;
22         $('body').css({
23            position: 'fixed',
24            width: '100%',
25            'top': -offsetY + 'px'
26         });
27      }
28   });
29
30   $(".close_btn, #navbar a").click(function() {
31      $('body').removeClass('navOpen');
32      $('body').addClass('navClose');
33      $(".hamburger").removeClass('is-active');
34      $('body').css('position', 'static');
35   });
36
37});
38
39$(document).ready(function() {
40   var w = $(window).width();
41   if (w < 768) {
42      $('.dropdown_btn').click(function() {
43         $(this).parent().find('.dropdown_main').slideToggle();
44         $(this).parent().toggleClass('active');
45      });
46      $('header .btn-search').click(function() {
47         $(this).parent().find('#searchform').slideToggle();
48      });
49   }
50});
51
52$(document).ready(function() {
53   $('.hamburger').click(function(e) {
54      e.stopPropagation();
55   });
56}).click(function(e) {
57   if ($(e.target).attr("class") != "navbar__inner" && $(e.target).parents('#navbar').length < 1 && $('body').hasClass('navOpen')) {
58      $('.hamburger').trigger('click');
59   }
60})
61
62$(document).ready(function() {
63   if ($('.scroll-active').length) {
64      $(document).on('scroll', onScroll)
65   }
66});
67
68function onScroll() {
69   var scroll = $(window).scrollTop();
70   var header = $("header").outerHeight();
71   $(".scroll-active a[href*='#']:not([href='#'])").each(function() {
72      var el = $(this).attr('href');
73      var offset = $(el).length ? $(el).offset().top : 0;
74      if ((scroll + header + 1) >= offset && ($(el).outerHeight() + offset) > (scroll + header)) {
75         $('.scroll-active a').removeClass('current');
76         $(this).addClass('current');
77      }
78   })
79}
80
81/* searchform
82=============================================*/
83if ($('.searchform').length > 0) {
84   $('.searchform').each(function() {
85      $(this).submit(function() {
86         if ($(this).find('input[type="text"]').val() == '') {
87            return false;
88         }
89      });
90   })
91}
92
93/*
94=============================================*/
95$(document).ready(function() {
96   $(window).scroll(function() {
97      var header = $('header').offset().top + $("header").outerHeight();
98      var footer = $('footer').offset().top - $(window).height();
99      var ScrollPos = $(window).scrollTop();
100
101      if (ScrollPos > 0) {
102         $('header').addClass('fixed');
103      } else {
104         $('header').removeClass('fixed');
105      }
106
107      if (ScrollPos > 0) {
108         $('.ft-fixed').addClass('fixed');
109         if (ScrollPos > footer) {
110            $('.ft-fixed').addClass('stop');
111         } else {
112            $('.ft-fixed').removeClass('stop');
113         }
114      } else {
115         $('.ft-fixed').removeClass('fixed');
116      }
117   });
118});
119
120/*
121=============================================*/
122$(document).ready(function() {
123   $('.scroll-down').click(function(e) {
124      $("html, body").animate({
125         scrollTop: $('.scroll-target').offset().top
126      });
127   });
128});
129
130/* Maiform
131=============================================*/
132$(document).ready(function() {
133   var $mailform = $('#mailform');
134   if ($mailform.length > 0) {
135      $('#mailform .form-btn .btn-confirm').click(function() {
136         setTimeout(function() {
137            if ($(".wpcf7-not-valid-tip").length > 0) {
138               $('html,body').animate({
139                  scrollTop: $("#mailform").offset().top - $("header").outerHeight(),
140               }, 300);
141            }
142
143            $('#mailform .input').each(function() {
144               var $this = $(this), tip1 = $this.find(".wpcf7-not-valid-tip"), tip2 = $this.find(".valid-tip-custom");
145               if ( tip2.length>0 ) {
146                  tip1.css("display", "none");
147                  if ( tip1.length>0 ) {                     
148                     var text = tip1.first().text();
149                     tip2.text(text);
150                     tip2.css("display", "block");
151
152                     $('html,body').animate({
153                        scrollTop: $("#mailform").offset().top - $("header").outerHeight(),
154                     }, 300);
155                  }
156               }
157            })
158         }, 1000);
159      });
160   }
161   if ($(".page-id-110").length>0) {
162      $(window).on('load', function() {
163         var header_height = $("header").outerHeight();
164         var $path = location.href;
165         var $index = $path.indexOf("#");
166         var $sub = $path.substring($index);
167         
168         if ($index != -1) {
169            $($sub).parents('.tabs-switch').find('#daily-form').trigger("click");
170         }
171      });
172   }
173});
174
175/* QA list
176=============================================*/
177$(document).ready(function() {
178   var faq_list = $(".box-qa");
179   if (faq_list.length > 0) {
180      faq_list.find("dl dt").click(function() {
181         $(this).parent().toggleClass("active");
182         $(this).parent().find("dd").slideToggle();
183      });
184   }
185});
186
187/* 
188=============================================*/
189$(document).ready(function() {
190   var video = $("video");
191   if (video.length > 0) {
192      video.each(function() {
193         $(this).attr('playsinline', '')
194      })
195   }
196});
197
198/* full height screen
199=============================================*/
200$(document).ready(function() {
201   if ($('.full-height').length) {
202      $(window).on('load', function() {
203         $('.full-height').css({
204            'height': window.innerHeight + 'px',
205         })
206      })
207      var timeoutId;
208      window.addEventListener("resize", () => {
209         clearTimeout(timeoutId);
210         timeoutId = setTimeout(() => {
211            $('.full-height').css({
212               'height': window.innerHeight + 'px',
213            })
214         }, 300);
215      });
216   }
217
218   if ( $('#mv').length ) {
219      var header = $('header').outerHeight();
220      $(window).on('load', function() {
221         $('#mv').css({
222            'height': window.innerHeight - header + 'px',
223         })
224      })
225      var timeoutId;
226      window.addEventListener("resize", () => {
227         clearTimeout(timeoutId);
228         timeoutId = setTimeout(() => {
229            $('#mv').css({
230               'height': window.innerHeight - header + 'px',
231            })
232         }, 300);
233      });
234   }
235})
236
237/* 
238=============================================*/
239$(document).ready(function() {
240   if ( $('.tabs-switch').length>0 ) {
241      $('.tab-item').click(function(){
242         var header_height = $("header").outerHeight();
243         var _this = $(this), _this_offset = _this.offset().top;
244         $('html,body').animate({
245            scrollTop: _this_offset - header_height
246         }, 500);
247      })
248   }
249})

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.