PageSourceSearch

https://www.takarashuzo.co.jp/cooking/js/common_sp_2019.js

js takarashuzo.co.jp collected 2026-10-02 07:10:06 UTC 3,718 bytes, 132 lines download raw bytes

1/*!
2 * レスポンシブページ用
3 * 2018.12
4 *
5 */
6
7/* ====================================
8  MENU 開く/閉じる
9===================================== */
10
11$(function () {
12    $("#opener_btnbar").on("click", function () {
13        $('.spnaviToggle').slideToggle();
14		$('#fixed-bar_001').toggleClass('h100');/* ==開いたときだけ高さ100にして中身がスクロールするように== */
15		/* $('#all,#Footer,#main').toggleClass('opa30');==開いたときはコンテンツを薄く== */
16		/* $('body').toggleClass('menu_on');==開いたときはコンテンツを薄く== */
17    });
18    $('.spnaviToggle .spnaviclose a').click(function () {
19        $('.spnaviToggle').slideToggle();
20		$('#fixed-bar_001').toggleClass('h100');/* ==閉じたら高さ100を戻す== */
21		/* $('#all,#Footer').toggleClass('opa30');==コンテンツを薄くを戻す== */
22		/* $('body').toggleClass('menu_on');==開いたときはコンテンツを薄く== */
23    });
24});
25
26
27/* ====================================
28  上部固定 「.fixed」)
29 https://www.nxworld.net/tips/stikcy-or-change-header-and-navigation-when-scrolling-using-jquery.html
30===================================== */
31$(function () {
32    if($('#fixed-bar_001').length == 0) return false;
33
34    var $win = $(window),
35        $main = $('#all'),
36        $nav = $('#fixed-bar_001'),
37        navHeight = $nav.outerHeight(),
38        navPos = $nav.offset().top,
39        fixedClass = 'fixed';
40
41    $win.on('load scroll', function () {
42        var value = $(this).scrollTop();
43        if (value > navPos) {
44            $nav.addClass(fixedClass);
45            $main.css('margin-top', navHeight);
46        } else {
47            $nav.removeClass(fixedClass);
48            $main.css('margin-top', '0');
49        }
50    });
51});
52
53/* ====================================
54  別ページへのアンカーリンクがずれてしまう場合の対策
55  2018.04
56 https://ko-e-da.com/92
57===================================== */
58// 別ページからのリンク
59$(window).on('load', function () {
60
61
62
63    var $nav = $('#fixed-bar_001'),
64        headerHight = $nav.outerHeight();
65
66
67
68    if (document.URL.match("#")) {
69        var str = location.href;
70        var cut_str = "#";
71        var index = str.indexOf(cut_str);
72        var href = str.slice(index);
73        var target = href;
74        var position = $(target).offset().top - headerHight - 3;
75        $("html, body").animate({
76            scrollTop: position
77        }, 550);
78        return false;
79    }
80
81});
82
83$(function () {
84    $('a[href*="#"]').click(function () {
85
86
87
88        var $nav = $('#fixed-bar_001'),
89            headerHight = $nav.outerHeight(),
90            str = $(this).attr('href');
91
92        // アンカーリンクを切り出す
93        var cut_str = "#";
94        var index = str.indexOf(cut_str);
95        var href = str.slice(index);
96
97
98        // ページ内にリンク先がある
99        if ($(href).length) {
100
101            console.log(headerHight);
102
103            var target = href;
104            var position = $(target).offset().top - headerHight - 4;
105            $("html, body").animate({
106                scrollTop: position
107            }, 550);
108            return false;
109        }
110
111    });
112
113});
114
115
116
117/* ====================================
118  ALTを表示
119===================================== */
120$(function(){
121
122  $('.altText').each(function(){
123
124    alt = $(this).find('img').addClass('pc').attr('alt');
125    $(this).prepend('<span class="sp">' + alt + '</span>');
126
127  });
128
129});
130
131// cookie認証
132document.write('<script src="/assets/js/cookie.js" type="text/javascript"></script>');

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.