PageSourceSearch

https://www.sekaiisan-wakayama.jp/common/js/navigation.js

js sekaiisan-wakayama.jp collected 2026-10-02 11:06:47 UTC 2,764 bytes, 95 lines download raw bytes

1/**
2 * File navigation.js.
3 *
4 * Handles toggling the navigation menu for small screens and enables TAB key
5 * navigation support for dropdown menus.
6 */
7 $(function(){
8  var state = false;
9  var scrollpos;
10  $('#bt_gmenu').on('click', function(){
11    if(state === false) {
12      scrollpos = $(window).scrollTop();
13      $('body').addClass('z_fixed').css({'top': -scrollpos});
14		$('+#nav-container',this).slideDown();
15      $('#bt_gmenu').addClass('z_active');
16      state = true;
17    } else {
18      $('body').removeClass('z_fixed').css({'top': 0});
19      window.scrollTo( 0 , scrollpos );
20      $('#nav-container').slideUp();
21      $('#bt_gmenu').removeClass('z_active');
22      state = false;
23    }
24  });
25});
26
27//固定ヘッダー設定
28
29//ページ内リンク
30$(function () {
31    var headerHight = 80; //ヘッダの高さ
32    $('a[href^="#"]').click(function(){
33        var href= $(this).attr("href");
34        var target = $(href === "#" || href === "" ? 'html' : href);
35        var position = target.offset().top-headerHight;
36        $("html, body").animate({scrollTop:position}, 550, "swing");
37        return false;
38    });
39});
40// ページ外リンク
41$(function() {
42      var headerHight = 80; //ヘッダの高さ
43      if(document.URL.match("#")) {
44      var str = location.href ;
45      var cut_str = "#";
46      var index = str.indexOf(cut_str);
47      var href = str.slice(index);
48      var target = $(href === "#" || href === "" ? 'html' : href);
49      var position = target.offset().top-headerHight;
50      $("html, body").animate({scrollTop:position}, 550, "swing");
51      return false;
52    }
53});
54
55
56
57
58//windowサイズ768で画像切替
59$(function() {
60  // 置換の対象とするclass属性。
61  var $elem = $('.responcive');
62  // 置換の対象とするsrc属性の末尾の文字列。
63  var sp = '_sp.';
64  var pc = '_pc.';
65  // 切替サイズ。
66  var replaceWidth = 768;
67
68  function imageSwitch() {
69    // ウィンドウサイズ取得
70    var windowWidth = parseInt(window.innerWidth);
71
72    // ページ内にあるすべての`.js-image-switch`に適応
73    $elem.each(function() {
74      var $this = $(this);
75      // ウィンドウサイズが768px以上であれば_spを_pcに置換
76      if(windowWidth >= replaceWidth) {
77        $this.attr('src', $this.attr('src').replace(sp, pc));
78
79      // ウィンドウサイズが768px未満であれば_pcを_spに置換
80      } else {
81        $this.attr('src', $this.attr('src').replace(pc, sp));
82      }
83    });
84  }
85  imageSwitch();
86
87  // 動的なリサイズは操作後0.1秒経ってから処理を実行する。
88  var resizeTimer;
89  $(window).on('resize', function() {
90    clearTimeout(resizeTimer);
91    resizeTimer = setTimeout(function() {
92      imageSwitch();
93    }, 100);
94  });
95});

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.