PageSourceSearch

https://local-prime.com/wp/wp-content/themes/local_prime/js/common.js

js local-prime.com collected 2026-10-05 03:39:54 UTC 11,960 bytes, 442 lines download raw bytes

1// JavaScript Document
2
3
4//*********************************************
5// slider
6//*********************************************
7
8jQuery(function($){
9
10let swipeOption = {
11  loop: true,
12  effect: 'slide',
13  autoplay: {
14    delay: 4000,
15    disableOnInteraction: false,
16  },
17  speed: 2000,
18  pagination: {
19    el: '.swiper-pagination',
20    clickable: true,
21  }
22}
23new Swiper('.TopSwiper', swipeOption);
24
25});
26
27
28//*********************************************
29// setViewport
30//*********************************************
31
32//$(function(){
33//    // setViewport
34//    spView = 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0';
35//    tbView = 'width=1200px,maximum-scale=2.0,user-scalable=1';
36// 
37//    if(navigator.userAgent.indexOf('iPhone') > 0 || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
38//        $('head').prepend('<meta name="viewport" content="' + spView + '" id="viewport">');
39//    } else if(navigator.userAgent.indexOf('iPad') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0){
40//        $('head').prepend('<meta name="viewport" content="' + tbView + '" id="viewport">');
41//    } 
42//});
43
44
45
46
47
48//*********************************************
49// gotop
50//*********************************************
51
52$(function() {
53    var pageTop = $('.totop');
54    pageTop.hide();
55    $(window).scroll(function () {
56        if ($(this).scrollTop() > 500) {
57            pageTop.fadeIn();
58        } else {
59            pageTop.fadeOut();
60        }
61    });
62    pageTop.click(function () {
63        $('body, html').animate({scrollTop:0}, 500, 'swing');
64        return false;
65    });
66});
67
68
69
70//*********************************************
71// scroll
72//*********************************************
73
74$(function(){
75  // #ã§å§‹ã¾ã‚‹ãƒªãƒ³ã‚¯ã‚’ã‚¯ãƒªãƒƒã‚¯ã—ãŸå ´åˆ
76  $('a[href^="#"]').click(function() {
77    // スクロールの速度
78    let speed = 400;
79    // スクロールタイプ
80    let type = 'swing';
81    // href属性の取得
82    let href= $(this).attr("href");
83    // 移動先の取得(hrefが#indexならトップ$(html)に、)
84    let target = $(href == "#index" ? 'html' : href);
85    // 移動先のポジション取得
86    let position = target.offset().top;
87    // animateでスムーススクロール
88    $('body,html').animate({scrollTop:position}, speed, type);
89    return false;
90  });
91});
92
93
94//*********************************************
95// menu
96//*********************************************
97
98$(window).on('scroll',function(){
99
100  $(".box h3 span").each(function(){
101    var position = $(this).offset().top;
102    var scroll = $(window).scrollTop();
103    var windowHeight = $(window).height();
104    if (scroll > position - windowHeight){
105      $(this).addClass('isActive');
106    }
107  });
108  
109 });
110
111
112
113//*********************************************
114// menu
115//*********************************************
116
117$(function(){
118  $('.menu-trigger').on('click',function(){
119    $(this).toggleClass('active');
120    $('.header-inner').fadeToggle();
121  });
122  
123//  $('.menu-trigger').on('click',function(){
124//    $(this).toggleClass('active');
125//    $('.header-inner').fadeOut();
126//  });
127  
128  $('.header-inner .main a').on('click',function(){
129    $('.header-inner').fadeOut();
130  });
131});
132
133
134
135//*********************************************
136// accordion
137//*********************************************
138
139
140$(function () {
141    $('.cont02 .block a').on('click', function () {
142//    $(this).next().slideToggle();
143    $(this).children('a .open').slideToggle();
144    $(this).children('a .close').slideToggle();
145
146    $(this).closest('li').find('.hideBox').slideToggle();
147//    $('.cont02 .block a .close').slideToggle();
148//    $('.cont02 .block a .open').slideToggle();
149//    $(this).next('.hideBox').slideToggle();
150  });
151});
152
153
154
155
156//*********************************************
157// wow
158//*********************************************
159var wow = new WOW(
160  {
161    boxClass:     'wow',      // animated element css class (default is wow)
162    animateClass: 'animated', // animation css class (default is animated)
163    offset:       0,          // distance to the element when triggering the animation (default is 0)
164    mobile:       false       // trigger animations on mobile devices (true is default)
165  }
166);
167wow.init();
168
169
170
171
172
173//*********************************************
174// scroll
175//*********************************************
176
177
178/* $(window).scroll(function () {
179  if($(window).scrollTop() > 100) {
180    $('header').addClass('fixed');
181  } else {
182    $('header').removeClass('fixed');
183  }
184}); */
185
186
187
188
189
190//*********************************************
191// anker
192//*********************************************
193
194
195jQuery(function(){
196    var windowWidth = $(window).width();
197    var headerHight = 100; 
198    jQuery('a[href^=#]').click(function() {
199    var speed = 1000;
200    var href= jQuery(this).attr("href");
201    var target = jQuery(href == "#" || href == "" ? 'html' : href);
202    var position = target.offset().top-headerHight;
203    jQuery('body,html').animate({scrollTop:position}, speed, 'swing');
204    return false;
205   });
206});
207
208
209
210
211
212//*********************************************
213// 文字数制限
214//*********************************************
215$(function() {
216   var count = 30;
217 $('.text_limit30').each(function() {
218     var thisText = $(this).text();
219      var textLength = thisText.length;
220       if (textLength > count) {
221          var showText = thisText.substring(0, count);
222          var insertText = showText += '...';
223          $(this).html(insertText);
224      };
225  });
226});
227
228
229
230$(function() {
231   var count = 20;
232 $('.text_limit20').each(function() {
233     var thisText = $(this).text();
234      var textLength = thisText.length;
235       if (textLength > count) {
236          var showText = thisText.substring(0, count);
237          var insertText = showText += '...';
238          $(this).html(insertText);
239      };
240  });
241});
242
243
244
245
246
247//*********************************************
248// フローティング
249//*********************************************
250(function($) {
251 
252$(function () {
253    //click
254    $(".floatingBanner .bl_floatingBanner_close").click(function(){
255    $(".floatingBanner").fadeOut();
256    $(window).off("scroll", display);
257    });
258});
259
260})(jQuery);
261
262
263
264
265
266
267
268//*********************************************
269// 要素をグラデーションで隠して開閉
270//*********************************************
271$(function(){
272  $('button').on('click', function(){
273    // クリックしたボタンの親要素にクラスを付与
274    const target = $(this).closest('.container');
275    
276    // activeクラスを常に追加(外さない)
277    target.addClass('active');
278
279    // スクロール領域も含めた高さを取得・付与する
280    const height = target.get(0).scrollHeight;
281    target.css('height', height);
282
283    // テキストを変更する
284    $(this).text('閉じる');
285  });
286});
287
288
289
290
291
292
293
294
295//*********************************************
296// matchHeight 
297//*********************************************
298$(function() {
299    function setH4Heights() {
300        // 行あたりのアイテム数を設定
301        var itemsPerRow = $(window).width() < 768 ? 2 : 3; // スマホの場合は2、それ以外は3
302
303        // 行ごとの最大高さを管理する配列
304        var rowHeights = [];
305
306        // 各行をループ
307        $("main.post section .txt").each(function(index) {
308            var h4 = $(this).find("h3");
309            var rowIndex = Math.floor(index / itemsPerRow); // 現在の行インデックスを取得
310
311            // 現在の行の最大高さを取得
312            if (!rowHeights[rowIndex]) {
313                rowHeights[rowIndex] = 0; // 初期化
314            }
315            if (h4.height() > rowHeights[rowIndex]) {
316                rowHeights[rowIndex] = h4.height(); // 最大高さを更新
317            }
318        });
319
320        // 各行のh4に最大高さを適用
321        $("main.post section .txt").each(function(index) {
322            var h4 = $(this).find("h3");
323            var rowIndex = Math.floor(index / itemsPerRow); // 現在の行インデックスを取得
324            h4.css("height", rowHeights[rowIndex] + "px"); // 最大高さを設定
325        });
326    }
327
328    // 初回実行
329    setH4Heights();
330
331    // リサイズイベント
332    $(window).on('resize', function() {
333        setH4Heights();
333 // リサイズ時にも高さを再設定
334    });
335});
336
337
338
339$(function(){ 
340   //高さの最大値を代入するための変数h
341   var h = 0; 
342
343   //それぞれの要素の高さを調べる
344  $("#busspot .cont02 main section .txt h4").each(function(){
345      // 要素の高さをと変数hの値を比較し、大きい方を変数hに代入します
346     if($(this).height() > h) {
347	 	h = $(this).height();
348	 }
349   });
350   
351   // 要素の高さを変数hの値に統一します
352   $("#busspot .cont02 main section .txt h4").css("height", h + "px");
353});
354
355
356
357
358$(function() {
359    function setH4Heights() {
360        // 行あたりのアイテム数を設定
361        var itemsPerRow = $(window).width() < 768 ? 2 : 3; // スマホの場合は2、それ以外は3
362
363        // 行ごとの最大高さを管理する配列
364        var rowHeights = [];
365
366        // 各行をループ
367        $("#busspot .cont03 main section").each(function(index) {
368            var h4 = $(this).find("h4");
369            var rowIndex = Math.floor(index / itemsPerRow); // 現在の行インデックスを取得
370
371            // 現在の行の最大高さを取得
372            if (!rowHeights[rowIndex]) {
373                rowHeights[rowIndex] = 0; // 初期化
374            }
375            if (h4.height() > rowHeights[rowIndex]) {
376                rowHeights[rowIndex] = h4.height(); // 最大高さを更新
377            }
378        });
379
380        // 各行のh4に最大高さを適用
381        $("#busspot .cont03 main section").each(function(index) {
382            var h4 = $(this).find("h4");
383            var rowIndex = Math.floor(index / itemsPerRow); // 現在の行インデックスを取得
384            h4.css("height", rowHeights[rowIndex] + "px"); // 最大高さを設定
385        });
386    }
387
388    // 初回実行
389    setH4Heights();
390
391    // リサイズイベント
392    $(window).on('resize', function() {
393        setH4Heights();
393 // リサイズ時にも高さを再設定
394    });
395});
396
397
398
399
400
401//*********************************************
402// parallax 
403//*********************************************
404jQuery( window ).bind( 'scroll', function() {
405	scrolled = jQuery( window ).scrollTop();
406	weight1 = 0.02;
407	weight2 = 0.02;
408	weight3 = 0.02;
409	weight4 = 0.02;
410	jQuery( '.about .img01' ).css( 'top', 10 - scrolled * weight1 + '%' );
411	jQuery( '.about .img02' ).css( 'top', 30 - scrolled * weight2 + '%' );
412	jQuery( '.about .img03' ).css( 'top', 60 - scrolled * weight3 + '%' );
413	jQuery( '.about .img04' ).css( 'top', 80 - scrolled * weight4 + '%' );
414});
415
416
417jQuery(window).bind('scroll', function() {
418    var scrolled = jQuery(window).scrollTop(); // スクロール量を取得
419
420    jQuery('.about .img01, .about .img02, .about .img03, .about .img04').each(function() {
421        var offset = jQuery(this).offset().top; // 画像の位置
422
423        // 画像が画面の上から50pxの位置に達したら透明度を0にする
424        if (scrolled >= offset - 50) {
425            jQuery(this).css('opacity', 0); // 透明度を0に設定
426        } else {
427            jQuery(this).css('opacity', 1); // 画像が画面の上から50pxに達していない場合は透明度を1に戻す
428        }
429    });
430});
431
432
433
434
435
436
437
438
439
440
441
442

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.