$(function() { // fade $(".fade").hover(function(){ $(this).fadeTo("normal", 0.7); },function(){ $(this).fadeTo("normal", 1.0); }); var headerHight = 55; //ヘッダの高さ $('a[href^="#"],area[href*="#"]').click(function(){ var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top-headerHight; //ヘッダの高さ分位置をずらす $("html, body").animate({scrollTop:position }, 550, "swing"); return false; }); /*var gnavHeight; $(window).on('load resize',function(){ if($(window).width()>=959){ gnavHeight = $("#gnav").height(); } else if($(window).width()<959){ gnavHeight = 0; } }); $('a[href*=#],area[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length && target; if (target.length) { var sclpos = gnavHeight; var scldurat = 1000; var targetOffset = target.offset().top - sclpos; $('html,body') .animate({scrollTop: targetOffset}, {duration: scldurat}); return false; } } });*/ var showFlag = false; var topBtn = $('#pagetop'); topBtn.css('bottom', '-105px'); var showFlag = false; var ua = navigator.userAgent; //スクロールが100に達したらボタン表示 $(window).scroll(function () { if ($(this).scrollTop() > 100) { if (showFlag == false) { showFlag = true; topBtn.stop().animate({'bottom' : '0' }, 200); } } else { if (showFlag) { showFlag = false; topBtn.stop().animate({'bottom' : '-140px' }, 200); } } }); //スクロールしてトップ topBtn.click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); var id = $("body").attr("id"); $("#gnav li."+id).addClass("current"); // 現在のページをアクティブ var url = window.location.pathname; $('#gnav li a[href="'+url+'"]').addClass('active'); // ハンバーガーメニュー var $header = $('header'); // Nav Toggle Button $('#nav-toggle, #gnav li a').click(function(){ $header.toggleClass('open'); }); // メニューページ ダウンメーニュー $(".down_btn").on("click", function() { $(this).next().slideToggle(); $(this).toggleClass('active'); }); // youtube ポップアップ $('.popup-youtube').magnificPopup({ type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: false }); // $('.popup-youtube').on('click',function(){ // var target = $(this).attr('data-id'); // $.magnificPopup.open({ // items: { // src: '
', // // type: 'inline', // // modal: true // type: 'iframe', // mainClass: 'mfp-fade', // removalDelay: 160, // preloader: false, // fixedContentPos: false // } // }); // }); // スマホ var ua = navigator.userAgent; if(ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0){ //電話番号にリンクする $('.tel-link img').each(function(){ var alt = $(this).attr('alt'); $(this).wrap($('').attr('href', 'tel:' + alt.replace(/-/g, '')).append('')); }); // 画像名の「_pc」を「_sp」に置き換える $('.sp-img').each(function(){ $(this).attr("src",$(this).attr("src").replace('_pc', '_sp')); }); //画像のalt取得して表示 $('.altTxt').each(function(){ var alt = $(this).children('img').attr('alt'); $(this).html(alt); }); } $("#fakeLoader").fakeLoader({ timeToHide: 2000, zIndex: "999", bgColor: "#cf972c", spinner:"spinner1", //imagePath:"img/loading.png", callback: function () { AOS.init({ offset: 200, duration: 600, easing: 'ease-in-sine', delay: 100, startEvent: 'DOMContentLoaded' }); } });});