PageSourceSearch

https://midoriya-oita.com/wp-content/themes/gourmet/js/main.js

js midoriya-oita.com collected 2026-10-08 01:52:28 UTC 3,185 bytes, 104 lines download raw bytes

1// トップへ戻るボタン
2function PageTopAnime() {
3    var pageTop = document.querySelector('#page-top');
4    if (!pageTop) return;
5
6    var scroll = window.pageYOffset;
7    if (scroll >= 200) {
8        // 上から200pxスクロールしたら
9        pageTop.classList.remove('RightMove');
10        pageTop.classList.add('LeftMove');
11    } else {
12        if (pageTop.classList.contains('LeftMove')) {
13            pageTop.classList.remove('LeftMove');
14            pageTop.classList.add('RightMove');
15        }
16    }
17}
18
19// ヘッダーの高さに応じてbodyのマージンを調整
20function adjustBodyMargin() {
21    var header = document.querySelector('header');
22    if (header) {
23        // 特定のテーマの場合は自動調整を行わない
24        if (document.body.classList.contains('theme-hannari') ||
25            document.body.classList.contains('theme-hakata') ||
26            document.body.classList.contains('theme-momo') ||
27            document.body.classList.contains('theme-sptop') ||
28            document.body.classList.contains('front-sptop') ||
29            document.body.classList.contains('header-lp')) {
30            return;
31        }
32        var headerHeight = header.offsetHeight;
33        document.body.style.marginTop = headerHeight + 'px';
34    }
35}
36
37// アニメーションのトリガー
38function setupAnimations() {
39    jQuery(function ($) {
40        $('.fadebox').on('inview', function (event, isInView) {
41            if (isInView) {
42                $(this).stop().addClass('fadeIn');
43            } else {
44                $(this).stop().removeClass('');
45            }
46        });
47
48        $('.fadebox_left').on('inview', function (event, isInView) {
49            if (isInView) {
50                $(this).stop().addClass('fadeInLeft');
51            } else {
52                $(this).stop().removeClass('');
53            }
54        });
55
56        $('.fadebox_right').on('inview', function (event, isInView) {
57            if (isInView) {
58                $(this).stop().addClass('fadeInRight');
59            } else {
60                $(this).stop().removeClass('');
61            }
62        });
63
64        $('.fadebox_up').on('inview', function (event, isInView) {
65            if (isInView) {
66                $(this).stop().addClass('fadeInUp');
67            } else {
68                $(this).stop().removeClass('');
69            }
70        });
71    });
72}
73
74// ページトップボタンのクリックイベント
75function setupPageTopButton() {
76    const topElement = document.querySelector('#top');
77    if (topElement) {
78        topElement.addEventListener('click', function (e) {
79            e.preventDefault();
80            window.scrollTo({
81                top: 0,
82                behavior: 'smooth',
83            });
84        });
85    }
86}
87
88// 初期化
89document.addEventListener('DOMContentLoaded', function() {
90    // ヘッダーの高さ調整
91    adjustBodyMargin();
92    window.addEventListener('resize', adjustBodyMargin);
93
94    // ページトップボタンの設定
95    setupPageTopButton();
96
97    // アニメーションの設定
98    setupAnimations();
99});
100
101// スクロールイベント
102window.addEventListener('scroll', function () {
103    PageTopAnime();
104});

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.