PageSourceSearch

https://www.care-show.com/wp-content/themes/sng-ubm/common/js/common.js?ver=20200225-005453

js care-show.com collected 2026-09-28 10:20:28 UTC 9,314 bytes, 290 lines download raw bytes

1(function($) {
2
3  var flagSp = false;
4  $(window).on( 'load resize', function() {
5    var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
6    // スマホブレイクポイント定義
7    var breakPoint = 768;
8    if ( w > breakPoint ) {
9      flagSp = false;
10    } else {
11      flagSp = true;
12    }
13  });
14
15  $(function(){
16
17    var $window = $(window),
18    w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
19    // スマホブレイクポイント定義
20    var breakPoint = 768;
21
22    // global nav
23    // スマホ
24    var $spNav = $('#gnav'),
25    $spNavBtn = $('#btn-sp-nav');
26    $spNavBtn.on('click', function() {
27      $(this).toggleClass('js-close');
28      $spNav.slideToggle('fast');
29    });
30    // スマホアコーディオン
31    $('#gnav .js-has--child').each(function() {
32      var $accordion = $(this);
33      $accordion.on('click',function() {
34        var $this = $(this),
35        $accordionContent = $accordion.find('.l-gnav--sub'),
36        $accordionClass = 'js-close';
37        if ( flagSp ) {
38          $accordionContent.slideToggle('fast');
39          $this.toggleClass($accordionClass);
40        }
41      });
42    });
43
44    // PC
45    $('.l-gnav .js-has--child').mouseenter(function() {
46      // $(this).addClass('js-hover');
47      $childPanel = $(this).children('.l-gnav--sub');
48      if ( !flagSp ) {
49        $childPanel.stop().slideDown('fast');
50      }
51    }).mouseleave(function(){
52      $childPanel = $(this).children('.l-gnav--sub');
53      // $(this).removeClass('js-hover');
54      if ( !flagSp ) {
55        $childPanel.stop().slideUp('fast');
56      }
57    });
58    function stickyGnav() {
59      var $gnav = $('#gnav-sticky'),
60      scroll = $(window).scrollTop(),
61      height = $('#header').outerHeight() + 200;
62      if ( $(window).scrollTop() > height ) {
63        $gnav.addClass('js-fixed');
64      } else {
65        $gnav.removeClass('js-fixed');
66      }
67    }
68
69    // gnav control
70    function controlGnav() {
71      var $Nav = $('#gnav');
72      $Nav.css('display', '');
73      $('#btn-sp-nav').removeClass('js-close');
74      $('.l-gnav--sub').css('display', '');
75      // $('.l-gnav__list__item.js-has--child').addClass('js-close');
76    }
77
78    // header固定
79    function fix_header() {
80      var $header = $('#header-fixed'),
81      scroll = $(window).scrollTop(),
82      height = $header.outerHeight(),
83      navH = $('#gnav').outerHeight();
84      if ( $(window).scrollTop() > navH ) {
85        $header.addClass('js-fixed');
86      } else {
87        $header.removeClass('js-fixed');
88      }
89    }
90    function fix_gnav() {
91      var $gnav = $('#gnav'),
92      scroll = $(window).scrollTop(),
93      height = $gnav.outerHeight();
94      if ( $(window).scrollTop() > height ) {
95        $gnav.addClass('js-fixed');
96      } else {
97        $gnav.removeClass('js-fixed');
98      }
99    }
100
101    // サイドバー
102    $('.l-sidebar__block--accordion').each(function() {
103      var $accordion = $(this),
104      $accordionBtn = '.l-sidebar__title';
105      $accordion.find($accordionBtn).on('click',function() {
106        if ( w <= breakPoint ) {
107          var $this = $(this),
108          $accordionContent = $accordion.find('.l-sidebar__block__inner'),
109          $accordionClass = 'js-close';
110          $accordionContent.slideToggle('fast');
111          // $accordionContent.toggleClass($accordionClass);
112          $this.toggleClass($accordionClass);
113        }
114      });
115    });
116    // サイドバー control
117    function controlSidebar() {
118      var $window = $(window),
119      w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
120      var $sideContent = $('.l-sidebar__block--accordion .l-sidebar__block__inner'),
121      $sideBtn = $('.l-sidebar__title');
122      if ( w > breakPoint ) {
123        $sideContent.css('display', 'block');
124        $sideBtn.addClass('js-close');
125      } else {
126        $sideContent.css('display', 'none');
127      }
128    }
129
130    // ギャラリー
131    if ( $('.p-gallery__list').length ) {
132      $('.p-gallery__list').photoSwipe();
133    }
134
135    // pagetop
136    var $pageTop = $('#pagetop');
137    $pageTop.on('click', function() {
138      var speed = 400;
139      $( 'html,body' ).animate( {scrollTop:0}, speed, 'swing' ) ;
140    });
141
142    // アコーディオン
143    $('.js-accordion').each(function() {
144      var $accordion = $(this),
145      $accordionBtn = '.js-accordion__btn';
146      $accordion.find($accordionBtn).on('click',function() {
147        var $this = $(this),
148        $accordionContent = $accordion.find('.js-accordion__content'),
149        $accordionClass = 'js-close';
150        $accordionContent.slideToggle('fast');
151        $accordionContent.toggleClass($accordionClass);
152        $this.toggleClass($accordionClass);
153      });
154    });
155    // スマホアコーディオン
156    $('.js-accordion--sp').each(function() {
157      var $accordion = $(this),
158      $accordionBtn = '.js-accordion--sp__btn';
159      $accordion.find($accordionBtn).on('click',function() {
160        var $this = $(this),
161        $accordionContent = $accordion.find('.js-accordion--sp__content'),
162        $accordionClass = 'js-close';
163        $accordionContent.slideToggle('fast');
164        $accordionContent.toggleClass($accordionClass);
165        $this.toggleClass($accordionClass);
166      });
167    });
168
169    // タブ切り替え
170    $tabBtnItem = $('.p-tab__btn__item');
171    $tabBtnItem.on('click', function() {
172      //セレクタ設定
173      var $this = $(this);
174      var $tab = $this.parents('.p-tab');
175      var $thisTabBtn = $tab.find($tabBtnItem);
176      var $thisTabContents = $tab.find('.p-tab__content');
177      var $currentClass = 'js-active';
178      $thisTabBtn.removeClass($currentClass);
179      $this.addClass($currentClass);
180      var thisElmIndex =  $thisTabBtn.index(this);
181      $thisTabContents.removeClass($currentClass);
182      $thisTabContents.eq(thisElmIndex).addClass($currentClass);
183    });
184
185    // #で始まるアンカーをクリックした場合に処理
186    $('a[href^="#"]'+ 'a:not(.js-link--hash-not)').on('click', function() {
187      var speed = 400,
188      $window = $(window),
189      w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
190      href= $(this).attr("href"),
191      target = $(href == "#" || href == "" ? 'html' : href),
192      position = target.offset().top,
193      navH = $('#gnav').outerHeight(),
194      headerH = $('#header-fixed').outerHeight(),
195      scroll = $(window).scrollTop();
196      if ( w > breakPoint ) {
197        var pos = target.offset().top - navH;
198      } else {
199        var pos = target.offset().top - headerH;
200      }
201      $('body,html').animate( { scrollTop:pos }, speed, 'swing' );
202      return false;
203    });
204    // 電話番号リンクをPCは無効にする
205    var ua = navigator.userAgent;
206    if( ua.indexOf('iPhone') < 0 && ua.indexOf('Android') < 0){
207      $('a[href^="tel:"]').css( 'cursor', 'default' ).click(function(event){
208        event.preventDefault();
209      });
210    }
211    // ウィンドウサイズ画像切り替え
212    var $elem = $('.js-image--switch'),
213    sp = '_sp.',
214    pc = '_pc.',
215    replaceWidth = breakPoint + 1;
216    function imageSwitch() {
217      var $window = $(window),
218      windowWidth = parseInt(window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth);
219      $elem.each(function() {
220        var $this = $(this);
221        if( windowWidth >= replaceWidth ) {
222          $this.attr('src', $this.attr('src').replace(sp, pc));
223        } else {
224          $this.attr('src', $this.attr('src').replace(pc, sp));
225        }
226      });
227    }
228    var $img = $elem;
229    for (var i = 0; i < $img.length; i++) {
230      var img = $('<img>');
231      img.load(function() {
232        $img.each(function() {
233          var $this = $(this);
234          $this.addClass('js-show');
235        });
236      });
237      img.attr('src', $('img').eq(i).attr('src'));
238    };
239
240    // 読み込み時
241    fix_header();
242    fix_gnav();
243    stickyGnav();
244    imageSwitch();
245    controlGnav();
246    controlSidebar();
247
248    // リサイズ
249    $(window).on('resize', function() {
250      var $window = $(window),
251      w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
252      fix_header();
253      imageSwitch();
254      controlGnav();
255      controlSidebar();
256    });
257
258    // スクロール時
259    $(window).on("scroll", function() {
260      fix_header();
261      fix_gnav();
262      stickyGnav();
263    });
264
265  });
266
267  $(window).on('load', function() {
268    // スマホブレイクポイント定義
269    var breakPoint = 768;
270    var $window = $(window),
271    w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
272    // 別ページのidリンク処理
273    var navH = $('#gnav').outerHeight();
274    var headerH = $('#header-fixed').outerHeight();
275    var url = $(location).attr('href');
276    if(url.indexOf("?id=") != -1) {
277      var id = url.split("?id=");
278      var $target = $('#' + id[id.length - 1]);
279      if($target.length) {
280        var targetPosition = $target.offset().top;
281        if ( w > breakPoint ) {
282          var pos = $target.offset().top - navH;
283        } else {
284          var pos = $target.offset().top - headerH;
285        }
286        $("html, body").animate({scrollTop:pos}, 400);
287      }
288    }
289  });
290})(jQuery);

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.