PageSourceSearch

https://www.kyotographie.jp/wp2025/wp-content/themes/kg2023/assets/js/common.js?v=1790273172

js kyotographie.jp collected 2026-09-24 18:06:24 UTC 16,670 bytes, 606 lines download raw bytes

1$(function () {
2
3  const assetsDir = document.querySelector("html").getAttribute("data-assets-dir");
4
5  $(".menuBtn").on("click", function () {
6    if ($('body').hasClass('is-menuActive')) {
7      $('body').removeClass('is-menuActive');
8      bodyScrollPrevent(false);
9    } else {
10      $('body').addClass('is-menuActive');
11      bodyScrollPrevent(true);
12    }
13  });
14
15  // ホバーで画像変更
16  if ($('.js-hoverImg').length) {
17    $(".js-hoverImg").hover(function () {
18      var $elmImg = $(this).find('img');
19      var src = $elmImg.attr("src");
20      var newSrc;
21      if (src.indexOf("-hover") <= 0) {
22        newSrc = src.substring(0, src.lastIndexOf(".")) + "-hover" + src.substring(src.lastIndexOf("."));
23      } else {
24        newSrc = src;
25      }
26      $elmImg.fadeOut(150, function () {
27        $elmImg.attr("src", newSrc).fadeIn(150);
28      });
29    }, function () {
30      var $elmImg = $(this).find('img');
31      var src = $elmImg.attr("src");
32      var newSrc = src.replace("-hover", "");
33      $elmImg.fadeOut(150, function () {
34        $elmImg.attr("src", newSrc).fadeIn(150);
35      });
36    });
37  }
38
39  // スクロールイベントの各位置取得 (グローバル変数)
40  var scrollPos = $(window).scrollTop();
41  var windowHeight = $(window).height();
42  var footerPos = $('.footer').offset().top;
43
44  $(window).on("scroll", function () {
45    scrollPos = $(this).scrollTop();
46    windowHeight = $(window).height();
47    footerPos = $('.footer').offset().top;
48  });
49
50  // 画面下部固定ボタン
51  if (!$('.home').length) {
52    // $('.js-bottomFix').fadeIn(100).css('display', 'flex');
53    $('.js-bottomFix').addClass('is-show');
54  }
55  $(window).on("scroll", function () {
56
57    if ($('.home').length) {
58      if (scrollPos > 100 && scrollPos <= footerPos - windowHeight) {
59        // $('.js-bottomFix').fadeIn().css('display', 'flex');
60        $('.js-bottomFix').addClass('is-show');
61      } else {
62        $('.js-bottomFix').removeClass('is-show');
63      }
64    } else {
65      if (scrollPos + windowHeight >= footerPos) {
66        $('.js-bottomFix').removeClass('is-show');
67      } else {
68        $('.js-bottomFix').addClass('is-show');
69      }
70    }
71  });
72
73  $(window).on("scroll", function () {
74    windowPos = $(this).scrollTop();
75    windowHeight = $(window).outerHeight();
76
77    scrollAnimation();
78  });
79
80  scrollAnimation();
81  // 下からふわっと
82  function scrollAnimation() {
83    $('.js-animated').each(function () {
84      var targetPos = $(this).offset().top;
85      if (scrollPos > targetPos - windowHeight + 200) {
86        $(this).addClass("is-on");
87      }
88    });
89  }
90
91  // //スムーズスクロール
92  // $('a[href^="#"]').click(function () {
93  //   var adjust = 0;
94  //   var speed = 400;
95  //   var href = $(this).attr("href");
96  //   var target = $(href == "#" || href == "" ? 'html' : href);
97  //   var position = target.offset().top - adjust;
98  //   $('body,html').animate({
99  //     scrollTop: position
100  //   }, speed, 'swing');
101  //   return false;
102  // });
103
104  // 背景固定
105  function bodyScrollPrevent(flag) {
106    let scrollPosition;
107    const body = document.getElementsByTagName('body')[0];
108    const ua = window.navigator.userAgent.toLowerCase();
109    const isiOS = ua.indexOf('iphone') > -1 || ua.indexOf('ipad') > -1 || ua.indexOf('macintosh') > -1 && 'ontouchend' in document;
110    const scrollBarWidth = window.innerWidth - document.body.clientWidth;
111    if (flag) {
112      body.style.paddingRight = scrollBarWidth + 'px';
113      if (isiOS) {
114        scrollPosition = -window.pageYOffset;
115        body.style.position = 'fixed';
116        body.style.width = '100%';
117        body.style.top = scrollPosition + 'px';
118      } else {
119        body.style.overflow = 'hidden';
120      }
121    } else if (!flag) {
122      body.style.paddingRight = '';
123      if (isiOS) {
124        scrollPosition = parseInt(body.style.top.replace(/[^0-9]/g, ''));
125        body.style.position = '';
126        body.style.width = '';
127        body.style.top = '';
128        window.scrollTo(0, scrollPosition);
129      } else {
130        body.style.overflow = '';
131      }
132    }
133  }
134
135  // winndowの高さいっぱい
136  if ($('.js-heightFull').length) {
137    var winHeight = $(window).height();
138
139
140    $(".js-heightFull").css("height", winHeight);
141
142    $(window).on('orientationchange', function () {
143      $(".js-heightFull").css("height", winHeight);
144    });
145  }
146
147  // クッキーの処理
148  if ($('.js-cookie').length) {
149    if (localStorage.getItem('access')) {
150      // console.log('2回目');
151    } else {
152      localStorage.setItem('access', 0);
153      $('.l-cookie').fadeIn(50).css('display', 'flex');
154      bodyScrollPrevent(true);
155      $('.js-cookieClosed').on('click', function () {
156        $('.js-cookie').fadeOut();
157        bodyScrollPrevent(false);
158      });
159    }
160  }
161
162  if ($('.edition-2024 .homeMv_slider').length || $('.edition-2023 .homeMv_slider').length) {
163
164
165    // メインビジュアルスライダー
166    var homeMvSlide = new Splide(".homeMv_slider", {
167      type: "fade",
168      rewind: true,
169      speed: 2000,
170      interval: 5000,
171      autoplay: true,
172      pagination: false,
173      arrows: false,
174      pauseOnHover: false,
175    });
176    homeMvSlide.on('active', function () {
177      // 2枚目以降
178      homeMvSlide.options = {
179        interval: 4000,
180      };
181    });
182    homeMvSlide.mount();
183
184  }
185
186
187  // トップページ
188  if ($('.home').length) {
189
190
191    //メインビジュアルスライダー
192    // var homeMvSlide = new Splide(".homeMv_slider", {
193    //   type: "fade",
194    //   rewind: true,
195    //   speed: 2000,
196    //   interval: 5000,
197    //   autoplay: true,
198    //   pagination: false,
199    //   arrows: false,
200    //   pauseOnHover: false,
201    // });
202    // homeMvSlide.on('active', function () {
203    //   // 2枚目以降
204    //   homeMvSlide.options = {
205    //     interval: 4000,
206    //   };
207    // });
208    // // homeMvSlide.mount();
209
210
211    if(document.querySelector(".homeGallery_slider")){
212
213
214
215      //メインビジュアルスライダー
216      var homeGallerySlide = new Splide(".homeGallery_slider", {
217        type: "fade",
218        type   : 'loop',
219        focus: 'center',
220        padding: '7.5rem',
221        rewind: true,
222        speed: 2000,
223        interval: 4500,
224        autoplay: true,
225        pagination: false,
226        arrows: false,
227        pauseOnHover: false,
228      });
229      // homeGallerySlide.on('active', function () {
230      //   // 2枚目以降
231      //   homeGallerySlide.options = {
232      //     interval: 4000,
233      //   };
234      // });
235      homeGallerySlide.mount();
236
237    }
238
239
240
241
242    $(window).on("scroll", function () {
243      if (scrollPos > windowHeight) {
244        $('.menuBtn').addClass('is-bgColor');
245      } else {
246        $('.menuBtn').removeClass('is-bgColor');
247      }
248    });
249
250
251  }
252
253
254  if ($('.l-col2Cont').length) {
255    var heightAside = $('.l-col2Cont_aside').height();
256    if (heightAside > windowHeight) {
257      $('.l-col2Cont').addClass('is-bottom');
258    }
259  }
260
261  // Week スライダー
262  if ($('.js-weekSlider').length) {
263    var weekSlider = document.getElementsByClassName('js-weekSlider');
264    for (var i = 0; i < weekSlider.length; i++) {
265      new Splide(weekSlider[i], {
266        type: 'slide',
267        perPage: 5,
268        gap: 16,
269        pagination: false,
270        perMove: 1,
271        autoplay: true,
272        rewind: true,
273        interval: 3000,
274        breakpoints: {
275          767: {
276            perPage: 2,
277            // gap: 16,
278          },
279        }
280      }).mount();
281    }
282  }
283
284  // Event スライダー
285  if ($('.js-eventSlider').length) {
286    var eventSlider = document.getElementsByClassName('js-eventSlider');
287    for (var i = 0; i < eventSlider.length; i++) {
288      new Splide(eventSlider[i], {
289        type: 'loop',
290        perPage: 4,
291        perMove: 1,
292        gap: 16,
293        pagination: false,
294        autoplay: true,
295        interval: 3500,
296        dragMinThreshold: 40,
297        breakpoints: {
298          767: {
299            perPage: 1.5,
300            gap: 20,
301          },
302        }
303      }).mount();
304    }
305  }
306
307  // 共通 スライダー
308  if ($('.js-commonSlider').length) {
309    $('.js-commonSlider').each(function () {
310      var slideIndex = $(this).find('.splide__slide').length;
311      console.log(slideIndex);
312      if (slideIndex < 2) {
313        $(this).addClass('is-none');
314      }
315    });
316    var weekSlider = document.getElementsByClassName('js-commonSlider');
317    for (var i = 0; i < weekSlider.length; i++) {
318      new Splide(weekSlider[i], {
319        type: 'loop',
320        // pagination: false,
321        autoplay: true,
322        arrows: false,
323        interval: 3500,
324      }).mount();
325    }
326  }
327
328  // programs一覧 メイソンリー
329  if ($('.js-programList').length) {
330
331    var exhibitionsList = new Macy({
332      container: '.js-programList',
333      // waitForImages: true,
334      // useOwnImageLoader: true,
335      margin: {
336        x: 32,
337        y: 84
338      },
339      columns: 3,
340      breakAt: {
341        767: {
342          columns: 1,
343          margin: {
344            y: 80
345          },
346        }
347      }
348    });
349
350    exhibitionsList.runOnImageLoad(function () {
351      exhibitionsList.recalculate(true);
352    }, true);
353  }
354
355  // programs詳細 縦画像
356  if ($('.l-post_imgBlock').length) {
357    $('.l-post_imgBlock').each(function () {
358      if ($(this).hasClass('-vertical')) {
359        var $this = $(this);
360        var width;
361        $this.imagesLoaded(function () {
362          width = $this.find('.m-imgView').width();
363          $this.find('.m-caption').width(width);
364        });
365
366        $(window).resize(function () {
367          width = $this.find('.m-imgView').width();
368          $this.find('.m-caption').width(width);
369        });
370      }
371    });
372  }
373
374  if ($('.programdetailArtist_imgBox').length) {
375    $('.programdetailArtist_imgBox').each(function () {
376      if ($(this).hasClass('-vertical')) {
377        var $this = $(this);
378        var width;
379        $this.imagesLoaded(function () {
380          width = $this.find('.m-imgView').width();
381          $this.find('.m-caption').width(width);
382        });
383
384        $(window).resize(function () {
385          width = $this.find('.m-imgView').width();
386          $this.find('.m-caption').width(width);
387        });
388      }
389    });
390  }
391
392  //開閉リスト
393  if ($('.js-toggleList').length) {
394    $(".js-toggleList>dl>dd").slideUp(0);
395    $(".js-toggleList>dl>dt").on('click', function () {
396      $(this).next("dd").slideToggle(350, 'swing');
397      $(this).parent('dl').toggleClass("is-active");
398    });
399  }
400
401  // mapページ
402  if ($('.map').length) {
403
404    // コンテンツスライダー
405    var mapListSlider = new Splide(".js-mapList", {
406      direction: 'ttb',
407      height: '260px',
408      speed: 2000,
409      pagination: false,
410      arrows: false,
411      wheel: true,
412      wheelMinThreshold: 3,
413      releaseWheel: true,
414      // drag: 'free',
415      wheelSleep: 300,
416      breakpoints: {
417        1000: {
418          direction: 'slide',
419          height: 'auto',
420          speed: 1000,
421        },
422      }
423    }).mount();
424
425    $('.marker_child').on('click', function () {
426      var index = $(this).data('slide-index');
427      mapListSlider.go(index - 1);
428      var $currentSlide = $('.splide__slide:nth-child(' + index + ')')
429      $currentSlide.addClass('is-current');
430      $('.splide__slide').not($currentSlide).removeClass('is-current');
431    });
432
433    $('.splide__slide').on('click', function () {
434      $('.splide__slide').not(this).removeClass('is-current');
435      $(this).addClass('is-current');
436    });
437
438    // モーダル内の画像の切り替え
439    $('.js-mapTypeBtn-program , .js-mapTypeCont-program').addClass('is-active');
440
441    $(document).on("click", ".js-mapTypeBtn-program", function () {
442      $('.js-mapTypeBtn-program , .js-mapTypeCont-program').addClass('is-active');
443      $('.js-mapTypeBtn-venue , .js-mapTypeCont-venue').removeClass('is-active');
444    });
445
446    $(document).on("click", ".js-mapTypeBtn-venue", function () {
447      console.log('test');
448      $('.js-mapTypeBtn-venue , .js-mapTypeCont-venue').addClass('is-active');
449      $('.js-mapTypeBtn-program , .js-mapTypeCont-program').removeClass('is-active');
450    });
451  }
452
453  // portfolioページ
454  if ($('.portfolio').length) {
455
456
457    $('.portfolioReviewer_modalCont').each(function (index) {
458      $(this).attr('data-revewer', (index + 1));
459    });
460    var maxReviewer = $('.portfolioReviewer_modalCont').length;
461
462    $('.js-portfolioPagination-prev').click(function () {
463      var $current = $(this).closest('.l-modal').find('.portfolioReviewer_modalCont');
464      var currentNum = $current.data('revewer');
465      var viewNum = currentNum - 1;
466
467      if (viewNum < 2) {
468        $('.js-portfolioPagination-prev').addClass('is-none');
469      }
470      $('.js-portfolioPagination-next').removeClass('is-none');
471
472      var viewCont = $('.portfolioReviewer_modalCont[data-revewer="' + viewNum + '"]').clone();
473
474      $current.fadeOut(150, function () {
475        $current.remove();
476        $('.l-modal_container').append(viewCont);
477        viewCont.fadeIn(300).css('display', 'flex');
478      });
479    });
480
481    $('.js-portfolioPagination-next').click(function () {
482      var $current = $(this).closest('.l-modal').find('.portfolioReviewer_modalCont');
483      var currentNum = $current.data('revewer');
484      var viewNum = currentNum + 1;
485
486      if (viewNum == maxReviewer) {
487        $('.js-portfolioPagination-next').addClass('is-none');
488      }
489      $('.js-portfolioPagination-prev').removeClass('is-none');
490      var viewCont = $('.portfolioReviewer_modalCont[data-revewer="' + viewNum + '"]').clone();
491
492      $current.fadeOut(150, function () {
493        $current.remove();
494        $('.l-modal_container').append(viewCont);
495        viewCont.fadeIn(300).css('display', 'flex');
496      });
497    });
498  }
499
500  // 説明SP時に隠す
501  $('.js-moreTextBox').each(function () {
502    var $this = $(this);
503    var moreHeight = $(this).innerHeight();
504    var heightStandard;
505
506    if ($('body').hasClass('en')) {
507      if ($this.hasClass('m-moreTextBox-large')) {
508        heightStandard = 240;
509      } else {
510        heightStandard = 120;
511      }
512    } else {
513      if ($this.hasClass('m-moreTextBox-large')) {
514        heightStandard = 264;
515      } else {
516        heightStandard = 132;
517      }
518    }
519
520    if (moreHeight > heightStandard) {
521      $(this).addClass('is-hide');
522      $(this).slideUp(0);
523      $(this).after('<button class="m-moreTextBtn js-moreTextBtn u-sp"><img src="' + assetsDir + '2/image/common/btn/readmore.svg" alt="READ MORE"></button>');
524    }
525  });
526  $(document).on("click", ".js-moreTextBtn", function () {
527    $(this).prev('.js-moreTextBox').css('height', 'auto').addClass('is-show');
528    $(this).prev('.js-moreTextBox').slideDown();
529    $(this).fadeOut(0);
530  });
531
532  // MODAL
533  if ($(".js-modal").length) {
534    $('.js-modalBtn').on('click', function (e) {
535
536      if ($(e.target).closest('ul.-links').length) {
537        // リンク部分がクリックされた場合は何もしない
538        return;
539      }
540
541      var modalCont;
542      if ($('body').hasClass('map')) {
543        modalCont = $(this).closest('.mapList_aside').next('.js-modalCont').clone().css('display', 'flex');
544      } else {
545        modalCont = $(this).next('.js-modalCont').clone().css('display', 'flex');
546      }
547      $('.l-modal_container').append(modalCont);
548      $('.js-modal').fadeIn();
549      bodyScrollPrevent(true);
550
551
552      // initFitImageSize({
553      //   imageWrapper: ".specialist_modalCont.l-interview .blockeditor > .wp-block-image",
554      //   baseWrapper: ".specialist_modalCont.l-interview",
555      //   // baseWrapper_sp: ".programdetailMain > .l-col2Cont",
556      //   // adjustWrapper: true,
557      //   includeCaption: "figcaption",
558      //   customMargin: 60,
559      // });
560
561    });
562
563    $('.js-modalColsed').on('click', function () {
564      $('.js-modal').fadeOut(function () {
565        $('.l-modal_container').empty();
566      });
567      bodyScrollPrevent(false);
568    });
569  }
570
571  // ホバーで画像変更
572  if ($('.js-ticketToggle').length) {
573    $('.js-ticketToggle dd').slideUp(0);
574    $('.js-ticketToggle dt').click(function () {
575      $(this).next().slideToggle();
576      $(this).toggleClass('is-active');
577    });
578  }
579
580  if ($('.js-programList2').length) {
581
582    var exhibitionsList = new Macy({
583      container: '.js-programList2',
584      // waitForImages: true,
585      // useOwnImageLoader: true,
586      margin: {
587        x: 32,
588        y: 84
589      },
590      columns: 3,
591      breakAt: {
592        767: {
593          columns: 1,
594          margin: {
595            y: 80
596          },
597        }
598      }
599    });
600
601    exhibitionsList.runOnImageLoad(function () {
602      exhibitionsList.recalculate(true);
603    }, true);
604  }
605
606});

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.