/** * common.js * * version --- 3.7 * updated --- 2012/10/12 */ /* !stack ------------------------------------------------------------------- */ jQuery(document).ready(function($) { var windowWidth = document.body.clientWidth; smoothScroll(); pageTop(); rollover(); //ロードイベント $(window).bind('load',function(){ lineUp(); textHeight(); }); if (windowWidth < 768){ //SPのみ localNavSp(); gNaviSp(); footerNaviSp(); selectLanguageSp(); } else { //PCのみ localNavPc(); gNaviPc(); opHover(); searchShow(); pieDef(); } }); /* !isUA -------------------------------------------------------------------- */ var isUA = (function(){ var ua = navigator.userAgent.toLowerCase(); indexOfKey = function(key){ return (ua.indexOf(key) != -1)? true: false;} var o = {}; o.ie = function(){ return indexOfKey("msie"); } o.fx = function(){ return indexOfKey("firefox"); } o.chrome = function(){ return indexOfKey("chrome"); } o.opera = function(){ return indexOfKey("opera"); } o.android = function(){ return indexOfKey("android"); } o.ipad = function(){ return indexOfKey("ipad"); } o.ipod = function(){ return indexOfKey("ipod"); } o.iphone = function(){ return indexOfKey("iphone"); } return o; })(); /* !rollover ---------------------------------------------------------------- */ var rollover = function(){ var suffix = { normal : '_no.', over : '_on.'} $('a.over, img.over, input.over').each(function(){ var a = null; var img = null; var elem = $(this).get(0); if( elem.nodeName.toLowerCase() == 'a' ){ a = $(this); img = $('img',this); }else if( elem.nodeName.toLowerCase() == 'img' || elem.nodeName.toLowerCase() == 'input' ){ img = $(this); } var src_no = img.attr('src'); var src_on = src_no.replace(suffix.normal, suffix.over); if( elem.nodeName.toLowerCase() == 'a' ){ a.bind("mouseover focus",function(){ img.attr('src',src_on); }) .bind("mouseout blur", function(){ img.attr('src',src_no); }); }else if( elem.nodeName.toLowerCase() == 'img' ){ img.bind("mouseover",function(){ img.attr('src',src_on); }) .bind("mouseout", function(){ img.attr('src',src_no); }); }else if( elem.nodeName.toLowerCase() == 'input' ){ img.bind("mouseover focus",function(){ img.attr('src',src_on); }) .bind("mouseout blur", function(){ img.attr('src',src_no); }); } var cacheimg = document.createElement('img'); cacheimg.src = src_on; }); }; /* !smoothScroll -------------------------------------------------------------- */ var smoothScroll = function(){ jQuery.easing.easeInOutCubic = function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }; $('a.scroll, .scroll a, #mapAncer:not(.mapAreaTop01) a').each(function(){ $(this).bind("click",function(e){ e.preventDefault(); var target = $(this).attr('href'); var targetY = $(target).offset().top; var parent = ( isUA.opera() )? (document.compatMode == 'BackCompat') ? 'body': 'html' : 'html,body'; $(parent).animate( {scrollTop: targetY-121 }, 400, 'easeInOutCubic' ); return false; }); }); } /* !pageTop -------------------------------------------------------------- */ var pageTop = function(){ jQuery.easing.easeInOutCubic = function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }; $('.pageTop a,.pageTopIn a, .pageTopFix a').each(function(){ $(this).bind("click",function(e){ e.preventDefault(); var parent = ( isUA.opera() )? (document.compatMode == 'BackCompat') ? 'body': 'html' : 'html,body'; $(parent).animate( {scrollTop: 0}, 400, 'easeInOutCubic' ); return false; }); }); } /* !localNavPc ---------------------------------------------------------------- */ var localNavPc = function(){ var navClass = document.body.className.toLowerCase(), parent = $("#lNavi"), prefix = 'lNav', current = 'current', regex = { a : /l/, dp : [ /l[\d]+_[\d]+_[\d]+_[\d]+/, /l[\d]+_[\d]+_[\d]+/, /l[\d]+_[\d]+/, /l[\d]+/ ] }, route = [], i, l, temp, node; $("ul ul", parent).hide(); if( navClass.indexOf("ldef") >= -1 ){ for(i = 0, l = regex.dp.length; i < l; i++){ temp = regex.dp[i].exec( navClass ); if( temp ){ route[i] = temp[0].replace(regex.a, prefix); } } console.log(route); if( route[0] ){ // depth 4 node = $("a."+route[0], parent); node.addClass(current); node.next().show(); node.parent().parent().show() .parent().parent().show() .parent().parent().show(); node.parent().parent().prev().addClass('parent'); node.parent().parent() .parent().parent().prev().addClass('parent'); node.parent().parent() .parent().parent() .parent().parent().prev().addClass('parent'); }else if( route[1] ){ // depth 3 node = $("a."+route[1], parent); node.addClass(current); node.next().show(); node.parent().parent().show() .parent().parent().show(); node.parent().parent().prev().addClass('parent'); node.parent().parent() .parent().parent().prev().addClass('parent'); }else if( route[2] ){ // depth 2 node = $("a."+route[2], parent); node.addClass(current); node.next().show(); node.parent().parent().show(); node.parent().parent().prev().addClass('parent'); }else if( route[3] ){ // depth 1 node = $("a."+route[3], parent); node.addClass(current); node.next().show(); }else{ } } } /* !localNavSp ---------------------------------------------------------------- */ var localNavSp = function(){ var navScroll = null; //close用オーバーレイヤー挿入 $('body').append('
'); $('.lNaviBtn01 a:not(.noBtn01)').click(function(){ if ( $(this).hasClass('active')) { $('#lNaviBtnBox01 a').removeClass('active'); $('#lNaviBtnBox01').stop().animate({'left': '0'}, 1000); $('#main').stop().animate({'left': '0'}, 1000); $('#sub').stop().animate({'right': '-275px'}, 1000,function(){ $('#overlay_lNav').hide(); $('#contentsWrap').removeClass('active'); $('#btn_gnavi a').on('click',function(){ if($(this).hasClass('active')) { $('#gNavi').slideUp(function(){ $('#overlay_gNav').hide(); $('#btn_gnavi a').removeClass('active'); }); } else { $('#overlay_gNav').show(); $('#gNavi').slideDown(); $('#btn_gnavi a').addClass('active'); } return false; }); }); // メニュー内のスクロール解除 $('#sub').height(''); navScroll.destroy(); $(':not(#subIn)').off('.noScroll'); } else { $('#overlay_lNav').show(); $('#contentsWrap').addClass('active'); $('#lNaviBtnBox01 a').addClass('active'); $('#lNaviBtnBox01').stop().animate({'left': '-265px'}, 1000); $('#main').stop().animate({'left': '-265px'}, 1000); $('#sub').stop().animate({'right': '0'}, 1000); $('#btn_gnavi a').off('click'); // メニュー内でスクロールできるように var scrollInMenu = (function() { if( navScroll ) { navScroll.refresh(); } var dispHeight; // ヘッダーが隠れている場合 if( $(window).scrollTop() > parseInt($('#header').outerHeight(true)+$('#mainimg').outerHeight(true) )) { dispHeight = window.innerHeight; } else { dispHeight = window.innerHeight - parseInt($('#header').outerHeight(true)+$('#mainimg').outerHeight(true)); } $('#subIn').height( dispHeight + 'px' ); navScroll = new iScroll( 'scroller', {desktopCompatibility:true} ); }); scrollInMenu(); window.addEventListener('resize', scrollInMenu, false); window.addEventListener('orientationchange', scrollInMenu, false); $(':not(#subIn)').on('touchmove.noScroll', function(e) { e.preventDefault(); }); } }); $('#lNavi_close a').click(function(){ $('#lNaviBtnBox01 a').removeClass('active'); $('#lNaviBtnBox01').stop().animate({'left': '0'}, 1000); $('#main').stop().animate({'left': '0'}, 1000); $('#sub').stop().animate({'right': '-275px'}, 1000,function(){ $('#overlay_lNav').hide(); $('#contentsWrap').removeClass('active'); $('#btn_gnavi a').on('click',function(){ if($(this).hasClass('active')) { $('#gNavi').slideUp(function(){ $('#overlay_gNav').hide(); $('#btn_gnavi a').removeClass('active'); }); } else { $('#overlay_gNav').show(); $('#gNavi').slideDown(); $('#btn_gnavi a').addClass('active'); } return false; }); }); // メニュー内のスクロール解除 $('#sub').height(''); navScroll.destroy(); $(':not(#subIn)').off('.noScroll'); openflag = !openflag; return false; }); if($('#lNaviBtnBox01').size() > 0) { function fixedMenu() { // ヘッダーが見えなくなったら、ナビボタン追従 if( $(window).scrollTop() > parseInt($('#header').outerHeight(true)+$('#mainimg').outerHeight(true) )) { $('#contents').addClass('menumove'); $('#lNaviBtnBox01').addClass('fixed'); $('#sub').addClass('fixed'); // ヘッダーが見えたら、本来の位置へ } else { $('#lNaviBtnBox01').removeClass('fixed'); $('#contents').removeClass('menumove'); $('#sub').removeClass('fixed'); } } var resizeTimer = null; $(window).on('scroll resize', function() { fixedMenu(); }) $(window).on('orientationchange resize', function() { if( $('#lNaviBtnBox01').hasClass('fixed') ) { $('#lNaviBtnBox01').width( $(window).width() ); } }) } } /* !gNaviPc ---------------------------------------------------------------- */ var gNaviPc = function(){ //メニューテキスト中央揃え $('#gNavi > ul > li a.trigger').append(''); //フェードメニュー $('#gNavi a.trigger').click(function(){ if($(this).hasClass('active')) { $('#overlay_gNav').stop().fadeOut(300); $('.subNavi01').stop().fadeOut(300); $(this).removeClass('active'); } else { $('#overlay_gNav').show(); $('#gNavi a.trigger').removeClass('active'); $('.subNavi01').stop().fadeOut(300); $(this).next().stop().fadeIn(300); $(this).addClass('active'); } return false; }); //オーバーレイヤークリックでclose $('#headerIn, #contentsWrap ,#footer, .subNavi01, #topImage').click(function(){ $('.subNavi01').stop().fadeOut(300); $('#gNavi a.trigger').removeClass('active'); }); } /* !gNaviSp ---------------------------------------------------------------- */ var gNaviSp = function(){ //close用オーバーレイヤー挿入 $('body').append('
'); $('#btn_gnavi a').click(function(){ if($('#btn_language a').hasClass('active')) { $('#selectLanguage').hide(); $('#overlay_lang').hide(); $('#btn_language a').removeClass('active'); } if($(this).hasClass('active')) { $('#gNavi').slideUp(function(){ $('#overlay_gNav').hide(); $('#lNaviBtnBox01').css('position',''); $('#btn_gnavi a').removeClass('active'); }); } else { $('#overlay_gNav').show(); $('#lNaviBtnBox01').css('position','relative'); $('#gNavi').slideDown(); $('#btn_gnavi a').addClass('active'); } return false; }); //オーバーレイヤークリックでclose $('#btnGnaviClose').click(function(){ $('#gNavi').slideUp(function(){ $('#overlay_gNav').hide(); $('#btn_gnavi a').removeClass('active'); }); }); } /* !selectLanguageSp ---------------------------------------------------------------- */ var selectLanguageSp = function(){ //close用オーバーレイヤー挿入 $('body').append('
'); $('#btn_language a').click(function(){ if($('#btn_gnavi a').hasClass('active')) { $('#gNavi').hide(); $('#btn_gnavi a').removeClass('active'); $('#overlay_gNav').hide(); $('#lNaviBtnBox01').css('position',''); } if($(this).hasClass('active')) { $('#selectLanguage').slideUp(function(){ $('#overlay_lang').hide(); $('#btn_language a').removeClass('active'); }); } else { $('#overlay_lang').show(); $('#selectLanguage').slideDown(); $('#btn_language a').addClass('active'); } return false; }); //オーバーレイヤークリックでclose $('#btnLanguageClose').click(function(){ $('#selectLanguage').slideUp(function(){ $('#overlay_lang').hide(); $('#btn_language a').removeClass('active'); }); }); } /* !footerNaviSp ---------------------------------------------------------------- */ var footerNaviSp = function(){ $('.footerLinks .trigger').click(function(){ $(this).toggleClass('active').parent().next().slideToggle(300); return false; }); } /* !opHover ---------------------------------------------------------------- */ var opHover = function(){ // 文字色を変える $(".textLink01 a, .textLink02 a, .textLink03, .textLink04, .textLink07, .ico_external01, .newsList01 a .newsDetail01, .pdfDLList01 ul li a .text, .bnList01In .text, .newsList01 a .text, .ico_pdf01, .ico_pdf02, .mapAreaList01 li a").hover(function() { $(this).stop().animate({color:"#e2dac8"}, '100'); },function() { $(this).stop().animate({color:"#c5b591"}, '100'); }); // 文字色を変える $(".sitemapWrap01 .linkList01 li a, .titSitemapList01 a").hover(function() { $(this).stop().animate({color:"#808080"}, '100'); },function() { $(this).stop().animate({color:"#000"}, '100'); }); $("#breadcrumb a").hover(function() { $(this).stop().animate({color: "#fff"}, '100'); },function() { $(this).stop().animate({color:"#c5b591"}, '100'); }); $(".textLink06 a").hover(function() { $(this).stop().animate({color: "#c5b591"}, '100'); },function() { $(this).stop().animate({color:"#000"}, '100'); }); $(".thumbList01 a, .infoList01 a, .newsList01 a, .pdfDLList01 ul li a").hover(function() { $(this).find('.titThumb01, .date01, .date, .text01').stop().animate({color:"#7f7f7f"}, '100'); },function() { $(this).find('.titThumb01, .date01, .date, .text01').stop().animate({color:"#000"}, '100'); }); $(".infoList01 a, .newsList01 a").hover(function() { $(this).find('.text01, .text').stop().animate({color:"#e2dac8"}, '100'); },function() { $(this).find('.text01, .text').stop().animate({color:"#c5b591"}, '100'); }); $("a:not(.noHover,#gNavi a.trigger, .boxProducts01 .imgArea01 a, .bxslider a), .boxProducts01 .imgArea01 a img, .btnInput01, .thumbList01 a, .infoList01 a, .newsList01 a .text").hover(function() { $(this).find('.textLink01,.textLink02,.textLink03,.textLink04, .titThumb02, .newsText, .ico_pdf01').stop().animate({color:"#e2dac8"}, '100'); $(this).find('img').stop().fadeTo(300, 0.5); },function() { $(this).find('.textLink01,.textLink02,.textLink03,.textLink04, .titThumb02, .newsText, .ico_pdf01').stop().animate({color:"#c5b591"}, '100'); $(this).find('img').stop().fadeTo(300, 1); }); $(".ul_2column01 a").hover(function() { $(this).find('.title01, .text01').stop().animate({color:"#7f7f7f"}, '100'); $(this).find('.title01 span').stop().animate({color:"#e2dac8"}, '100'); },function() { $(this).find('.title01, .text01').stop().animate({color:"#000"}, '100'); $(this).find('.title01 span').stop().animate({color:"#c5b591"}, '100'); }); $(".ul_3column01 a").hover(function() { $(this).find('.title01, .text01').stop().animate({color:"#7f7f7f"}, '100'); $(this).find('.title01 span').stop().animate({color:"#e2dac8"}, '100'); },function() { $(this).find('.title01, .text01').stop().animate({color:"#000"}, '100'); $(this).find('.title01 span').stop().animate({color:"#c5b591"}, '100'); }); $(".ul_relationLink03 a").hover(function() { $(this).find('.titRelationLink01, .textRelationLink01').stop().animate({color:"#7f7f7f"}, '100'); },function() { $(this).find('.titRelationLink01, .textRelationLink01').stop().animate({color:"#000"}, '100'); }); $("#gNavi .trigger, #headerLinks .list01 a, #lNavi > ul > li li a:not(.current, .parent), .textLink05 a").hover(function() { $(this).stop().animate({color: "#c5b591"}, '100'); },function() { $(this).stop().animate({color:"#000"}, '100'); }); $("#gNavi .btn01 a, #gNavi .btn02 a, #gNavi .btn03 a, #gNavi .btn04 a").hover(function() { $(this).stop().animate({color:"#808080"}, '100'); },function() { $(this).stop().animate({color:"#fff"}, '100'); }); $("#gNavi figure").hover(function() { $(this).find('figcaption').stop().animate({color:"#808080"}, '100'); },function() { $(this).find('figcaption').stop().animate({color:"#fff"}, '100'); }); $("#footerIn a").hover(function() { $(this).stop().animate({color:"#919191"}, '100'); },function() { $(this).stop().animate({color:"#fff"}, '100'); }); } /* !searchShow ---------------------------------------------------------------- */ var searchShow = function(){ $('#headerSearch a').click(function(){ $(this).parent().css('width','auto'); $(this).addClass('hide'); $('#headerSearch form').stop().fadeTo(300, 1); return false; }); } /* !PIE --------------------------------------------------- */ var pieDef = (function(){ if (window.PIE) { $('.btn_basic01 a, .btn_basic02 a, .btn_basic03 a, .btn_basicS01 a, .btn_basicS02 a, .btn_basicS03 a, .btn_basicL01 a, .btn_basicL02 a, .btn_basicL03 a, .btnBackToList01 a, .btnSearch01 a, .btnPrint01 a, .btnPdfDL01 a, .ul_productSearch01 > li p.title01, .ul_productSearch01 > li > div.boxProductSearchIn01, .sectionIrBox01, .boxMoreInfo01 h4, .boxMoreInfo01In, .btnInput01, .btnInput02, .confirmCk01, .boxSumInfo01 h4, .boxSumInfo01In, .boxProducts03, .boxProducts03 .btn01 a, .btn_searchItem01 input, #gNavi .btn04 a, .subNavi01In .btn03 li, .boxProducts02In ul li a').each(function() { PIE.attach(this); }); } }); /* !lineUp --------------------------------------------------- */ var lineUp = (function(){ $(".autoHeight01, .autoHeight02, .textHeight01").lineUp({ onFontResize : false, onResize : true }); }); /* !textHeight --------------------------------------------------- */ var textHeight = (function(){ $(".textHeight01").each(function(){ var tHeight = $(this).height(); $(this).append(''); }); });