/* 2015/04/28 森井 */ /* アクセス解析 */ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-64333672-2', 'auto'); ga('send', 'pageview'); /* ヘッダー上部の告知エリアをクッキーに応じて表示 */ $(function(){ // クッキーあれば if($.cookie("close")){ $("#top_info").hide(); } else { // クッキーないと表示 $("#top_info").show(); } // 閉じるをクリックで動作 $("#close_tutorial").click(function() { $("#top_info").slideUp(); $.cookie("close" , "close_click" , { expires: 31, path: "/" }); }); }); /* ナビゲーションマウスオーバで下階層を表示 */ $(function() { $(".nav li").hover(function() { $(this).children('ul').show(); }, function() { $(this).children('ul').hide(); }); }); /* トップのタブ切替 */ $(function() { $('#select-block-top > ul > li').click(function() { var num = $(this).parent().children('li').index(this); $('#select-block-top > ul').each(function(){ $(' > li',this).removeClass('active').eq(num).addClass('active'); }); $('.tab-switch').hide().eq(num).show(); }).first().click(); }); /* コンテンツ内のタブ切替 */ $(function() { $('#select-block > ul > li').click(function() { var num = $(this).parent().children('li').index(this); $('#select-block > ul').each(function(){ $(' > li',this).removeClass('active').eq(num).addClass('active'); }); $('.tab-switch').hide().eq(num).show(); }).first().click(); }); /* フッターのタブ切替1 */ $(function() { $('ul.bottom-tab1 > li').click(function() { var num = $(this).parent().children('li').index(this); $('ul.bottom-tab1').each(function(){ $(' > li',this).removeClass('active').eq(num).addClass('active'); }); $('.foot-area1').hide().eq(num).show(); }).first().click(); $('ul.bottom-tab2 > li').click(function() { var num = $(this).parent().children('li').index(this); $('ul.bottom-tab2').each(function(){ $(' > li',this).removeClass('active').eq(num).addClass('active'); }); $('.foot-area2').hide().eq(num).show(); }).first().click(); }); /* 一括選択ボタン */ $(function() { //一括チェック $('input.allCheck').on('change', function() { $('.name input[type="checkbox"]').prop('checked', this.checked); $('input.allCheck').prop('checked', this.checked); if($(".name input[type='checkbox']:checked").length > 0){ $(".inquiry-form.xs").removeAttr("disabled"); } else { $(".inquiry-form.xs").attr("disabled","disabled"); } }); // 一つ以上のチェックで一括問合せフォームを表示 $(".name input[type='checkbox']").click(function(){ if($(".name input[type='checkbox']:checked").length > 0){ $(".inquiry-form.xs").removeAttr("disabled"); } else { $(".inquiry-form.xs").attr("disabled","disabled"); } }); // 一つ以上のチェックされてたら一括問合せフォームを表示 if($(".name input[type='checkbox']:checked").length > 0){ $(".inquiry-form.xs").removeAttr("disabled"); } else { $(".inquiry-form.xs").attr("disabled","disabled"); } }); /* スムーススクロール */ $(function(){ // #で始まるアンカーをクリックした場合に処理 $('a[href^=#]').click(function() { var speed = 400; // ミリ秒 var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top; $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; }); }); /* フッター左側の都道府県リンク先切替え */ function EstType (num) { $("#fotter .foot-switch.foot-area1 li a").each(function() { var str = $(this).attr('href'); var str2 = str.substr(5,3); //現在の種別を取得 var replace = null; var replace = $(this).attr('href').replace(str2,"/"+num+"/") $(this).attr('href',replace); }); $('.foot-left li').removeClass('active').eq(num).addClass('active'); } /* フッター右側の市区町村リンク先切替え */ function EstType2 (num) { $("#fotter .foot-switch.foot-area2 li a").each(function() { var str = $(this).attr('href'); var str2 = str.substr(7,3); //現在の種別を取得 var replace = null; var replace = $(this).attr('href').replace(str2,"/"+num+"/") $(this).attr('href',replace); }); $('.foot-right li').removeClass('active').eq(num).addClass('active'); } /* 詳細と地域ページの右側メニュー固定(ie8〜) */ $(window).load(function () { var mainArea = $("#detail"); var sideWrap = $("#side2"); var sideArea = $("#side2-wrapp"); var wd = $(window); var mainH = mainArea.height(); var sideH = sideWrap.height(); if(sideH < mainH) { sideWrap.css({"height": mainH,"position": "relative"}); var sideOver = wd.height()-sideArea.height(); var starPoint = sideArea.offset().top + (-sideOver); var breakPoint = sideArea.offset().top + mainH; wd.scroll(function() { if(wd.height() < sideArea.height()){ if(starPoint < wd.scrollTop() && wd.scrollTop() + wd.height() < breakPoint){ sideArea.css({"position": "fixed", "bottom": "20px"}); }else if(wd.scrollTop() + wd.height() >= breakPoint){ sideArea.css({"position": "absolute", "bottom": "0"}); } else { sideArea.css("position", "static"); } }else{ var sideBtm = wd.scrollTop() + sideArea.height(); if(mainArea.offset().top < wd.scrollTop() && sideBtm < breakPoint){ sideArea.css({"position": "fixed", "top": "20px"}); }else if(sideBtm >= breakPoint){ var fixedSide = mainH - sideH; sideArea.css({"position": "absolute", "top": fixedSide}); } else { sideArea.css("position", "static"); } } }); } });