PageSourceSearch

https://www.hondacars-nankai.co.jp/home/js/common.js

js hondacars-nankai.co.jp collected 2026-09-30 22:57:47 UTC 4,150 bytes, 160 lines download raw bytes

1'use strict';
2
3var MutJs = MutJs || {};
4
5(function () {
6  var $win = $(window);
7  var scrollEventTimer = null;
8  var wrapper = $('#js-wrapper');
9  var header = $('#js-header');
10  var loader = $('#js-loader');
11  var gnav = $('#js-gnav');
12  var ua = navigator.userAgent;
13
14  MutJs.Init = function () {
15    this.headerFixed = true;
16    this.stickyHeader();
17    this.localOpen();
18    this.spGlobalNavigation();
19    this.spGlobalLocalNavigation();
20    this.setAnchorScroll();
21    this.setTelLink();
22  };
23
24/* header΁Տ
25=============================== */
26MutJs.Init.prototype.stickyHeader = function () {
27  var headerH = header.height();
28  var scrollPos = $win.scrollTop();
29  var triggerScrollPos = 320;
30
31  $win.on('scroll', function () {
32    scrollPos = $win.scrollTop();
33
34    if (scrollPos > triggerScrollPos) {
35      header.addClass('is-fixed');
36    } else {
37      header.removeClass('is-fixed');
38    }
39  });
40}
41
42/* Loader‰ðœ
43=============================== */
44$(function () {
45  var isHidden = function () {
46    loader.fadeOut(1000);
47  };
48  setTimeout(isHidden, 1000);
49});
50
51/* ƒOƒ[ƒoƒ‹ƒƒjƒ…[“WŠJ
52=============================== */
53MutJs.Init.prototype.localOpen = function () {
54  var localNavItem = $('.l-header-gnav__item');
55  var localNav = $('.l-header-drawer');
56
57  if ((mutUA.Mobile || mutUA.Tablet) && !mutUA.Desktop) {
58    localNavItem.on({
59      'mouseenter': function () {
60        if ($(this).find(localNav)) {
61          $(this).addClass('is-open');
62        }
63      },
64      'mouseleave': function () {
65        $(this).removeClass('is-open');
66      }
67    });
68  }
69}
70
71/* ƒAƒ“ƒJ[ƒXƒNƒ[ƒ‹
72=============================== */
73MutJs.Init.prototype.setAnchorScroll = function () {
74  var $anchorLink = $('a.js-anchor');
75  $anchorLink.on('click', function (e) {
76    e.preventDefault();
77    var speed = 800;
78    var fixHeaderHeight = (MutJs.init.headerFixed) ? (header).outerHeight() : 0;
79    var href = $(this).attr("href");
80    var $target = $(href == "#" || href == "" ? 'html' : href);
81    var position = $target.offset().top - fixHeaderHeight;
82    $("html, body").animate({ scrollTop: position }, speed, "easeOutSine");
83  });
84};
85
86
87/* ƒXƒ}ƒz“d˜b”ԍ†
88=============================== */
89MutJs.Init.prototype.setTelLink = function () {
90  if ((mutUA.Mobile || mutUA.Tablet) && !mutUA.Desktop) {
91    $('.js-tel').each(function () {
92      var txt = $(this).text();
93      $(this).addClass('_active');
94      $(this).attr('href', 'tel:' + txt.replace(/-/g, ''));
95    });
96  }
97}
98
99/* sp-navigation
100=============================== */
101MutJs.Init.prototype.spGlobalNavigation = function () {
102  $('#js-menu-trigger').on("click", function () {
103    $(this).toggleClass('is-active');
104    gnav.toggleClass('is-open');
105  });
106}
107MutJs.Init.prototype.spGlobalLocalNavigation = function () {
108  $('.js-gnav-trigger').on("click", function () {
109    $(this).toggleClass('is-open').next().toggleClass('is-open');
110  });
111}
112
113/* ”­“®
114=============================== */
115function onLoad() {
116  MutJs.init = new MutJs.Init();
117  onScroll();
118}
119
120function onScrolled() {
121  MutJs.scrollTop = $win.scrollTop();
122}
123
124function onScroll() {
125  MutJs.scrollTop = $win.scrollTop();
126}
127
128$win.on({ 'load': onLoad, 'scroll': onScroll });
129
130/* ƒy[ƒWƒXƒNƒ[ƒ‹
131=============================== */
132function isScrolledIntoView(elem) {
133  var docViewTop = $(window).scrollTop();
134  var docViewBottom = docViewTop + $(window).height();
135
136  var elemTop = $(elem).offset().top;
137  var elemBottom = elemTop + $(elem).height();
138
139  return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
140}
141})();
142
143/* “®‰æƒTƒEƒ“ƒhƒIƒ“ƒIƒt
144=============================== */
145$(function() {
146  var topMovie = $('#video');
147	  $("#sound_button").on('click', function() {
148    if ($(this).hasClass("sound_off")) {
149      $(this).removeClass("sound_off");
150      $(this).addClass("sound_on");
151
152      $("video").prop('muted', false);
153    } else {
154      $(this).removeClass("sound_on");
155      $(this).addClass("sound_off");
156
157      $("video").prop('muted', true);
158    }
159  });
160});

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.