/********************************************* * common.js * ------------------------------------------- * @namespace * - SHINSEIBANK * @init * @method plugin * @utility plugin * - isNotPC * - isSmartPhone * - isTablet * - isAndroid * - isIE * - isIE8 * - isIE9 * - isIE10 * - isUA * - isFontSizeCheck * - isWindowSizeCheck * @requires * - jquery.js *********************************************/ /* ------------------------------------------- * @namespace ------------------------------------------- */ var SHINSEIBANK = SHINSEIBANK || {}; /* ------------------------------------------- * @init ------------------------------------------- */ // DOMの構築が完了したら実行 $(function(){ // veiwport /*var portraitWidth, landscapeWidth; $(window).bind("resize", function(){ if(Math.abs(window.orientation) === 0){ if(/Android/.test(window.navigator.userAgent)){ if(!portraitWidth)portraitWidth = $(window).width(); }else{ portraitWidth = $(window).width(); } $("html").css("zoom" , portraitWidth / 320 ); }else{ if(/Android/.test(window.navigator.userAgent)){ if(!landscapeWidth)landscapeWidth = $(window).width(); }else{ landscapeWidth = $(window).width(); } $("html").css("zoom" , landscapeWidth / 320 ); } }).trigger("resize");*/ // location SHINSEIBANK.module.navLocation(); // プラグインを実行する前に実行する処理 // for .boxToggle03 + .listTbl01 $('.listTbl01').each(function(){ $('> li', this).wrapInner(''); }); // for equalHeight var classEqualHeight = 'equalHeight', classEqualChild = 'equalChild_'; $('.linkBtnList02').each(function(){ $(this).addClass(classEqualHeight); $('> li > a', this).addClass(classEqualChild + 'link'); }); $('.navTab01 ul').each(function(){ $(this).addClass(classEqualHeight); $('> li > a', this).addClass(classEqualChild + 'link'); }); $('.linkBtnList08').each(function(){ $(this).addClass(classEqualHeight); $('> li:nth-child(1) > a, > li:nth-child(2) > a', this).addClass(classEqualChild + 'link'); }); $('.linkBtnList09').each(function(){ $(this).addClass(classEqualHeight); $('> li > a', this).addClass(classEqualChild + 'link'); }); $('.linkBtnList15').each(function(){ $(this).addClass(classEqualHeight); $('> li', this).addClass(classEqualChild + 'link'); }); $('.navAnchor01 ul[class*="col"]').each(function(){ $(this).addClass(classEqualHeight); //$('> li > a', this).addClass(classEqualChild + 'link'); }); $('.listTbl01').each(function(){ $(this).addClass(classEqualHeight); //$('> li > .cell', this).addClass(classEqualChild + 'span'); }); $('.boxLink06 .column').each(function(){ $(this).addClass(classEqualHeight); $('.col .box .catch .inner', this).addClass(classEqualChild + 'catch'); $('.col .box .outline .inner', this).addClass(classEqualChild + 'outline'); $('.col .box .link .inner', this).addClass(classEqualChild + 'link'); }); $('.boxLoan04 .column').each(function(){ $(this).addClass(classEqualHeight); $('.col .box .hdg01 .txt', this).addClass(classEqualChild + 'txt'); }); $('.boxLoan07 > .block > .box .choice ul.btn02').each(function(){ $(this).addClass(classEqualHeight); $('> li a', this).addClass(classEqualChild + 'btn'); }); $('.boxShop02 .btn01').each(function(){ $(this).addClass(classEqualHeight); $('> li:nth-of-type(n+2) a', this).addClass(classEqualChild + 'btn'); }); // for opRollover $('.boxFund01 .inner > .btn li a, .boxFund03 .inner > .btn li a, .boxSearch01 input[type="submit"], .boxAcc02 .boxAccBtn a, .boxForm01 .btn li', '.pc').addClass('opRollover'); }); // ページの読み込みが完了したら実行 //$(document).ready(function(){ $(window).load(function(){ // プラグインの実行 SHINSEIBANK.module.opacityPng(); SHINSEIBANK.module.accordion({ targetClass: '.boxAccWrap', toggleBtnClass: '.boxAccHdg', togglePanelClass: '.boxAccInner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '#navGlobal01', toggleBtnClass: '> dl > dd > ul > li > span', togglePanelClass: '> dl > dd > ul > li > span + ul', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '#navGlobal02', toggleBtnClass: '> dl > dd > ul > li > span', togglePanelClass: '> dl > dd > ul > li > span + ul', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxLink01', toggleBtnClass: '> ul > li > span', togglePanelClass: '> ul > li > span + ul', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxFaq01 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxFaq02 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle01 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle02 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle03 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle04', toggleBtnClass: '.toggleHdg01', togglePanelClass: '.togglebox01', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle05 > .box', toggleBtnClass: '[class*="hdg"]', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle06 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion({ targetClass: '.boxToggle07 > .box', toggleBtnClass: '.hdg', togglePanelClass: '.inner', switchClassName: 'open' }); SHINSEIBANK.module.accordion(); // SHINSEIBANK.module.rollover(); // SHINSEIBANK.module.opRollover(); SHINSEIBANK.module.tabSwitcher({ containerName: ".tabKitBox", noSwitchName: "noSwitch", naviClass: ".tabKitNav", btnClass: "li", panelClass: ".tabKitPanel > .panel", currentClassName: "on", firstTarget: "" }); SHINSEIBANK.module.tabSwitcher(); SHINSEIBANK.module.smoothScroll(); SHINSEIBANK.module.sizeFix(); SHINSEIBANK.module.linkExpand({ containerName: ".boxNews03", targetClass: "dl" }); SHINSEIBANK.module.linkExpand({ containerName: ".boxLink03", targetClass: ".btn" }); SHINSEIBANK.module.linkExpand({ containerName: ".boxLink04", targetClass: ".btn" }); SHINSEIBANK.module.linkExpand({ containerName: ".boxLink06 .column", targetClass: ".col" }); SHINSEIBANK.module.linkExpand({ containerName: ".boxLink08", targetClass: ".btn" }); SHINSEIBANK.module.linkExpand({ containerName: ".boxAdd03", targetClass: ".tel04" }); SHINSEIBANK.module.linkExpand(); SHINSEIBANK.module.equalHeight(true); // SHINSEIBANK.module.popup(); SHINSEIBANK.module.gmap(); SHINSEIBANK.module.placeholder01(); SHINSEIBANK.module.placeholder02(); SHINSEIBANK.module.copyrightAddYear(); SHINSEIBANK.module.tooltip(); SHINSEIBANK.module.header01(); SHINSEIBANK.module.header02(); // 個別パーツ /*$('.boxLoan04').each(function(){ // var var txtOpen = '詳しく見る', txtClose = '閉じる', classAccordionBox = '.accordionBox', classAccodionBtn = '.accodionBtn', classAccodionBtnOpen = 'open', classAccodionBtnClose = 'close', $accordionBox = $(classAccordionBox, this); // setting $(this).append('

' + txtOpen + '

'); // click $(this).on('click', classAccodionBtn, function(){ //alert('ほげ'); $accordionBox.slideToggle(); $(this).toggleClass(classAccodionBtnOpen + ' ' + classAccodionBtnClose); if($(this).hasClass(classAccodionBtnOpen)){ $(this).text(txtOpen); }else{ $(this).text(txtClose); } }); });*/ }); // ページの読み込みが完了したら実行 $(document).ready(function(){ window.onresize = function(){ SHINSEIBANK.module.equalHeight(true); }; }); /* ------------------------------------------- * @plugin ------------------------------------------- */ SHINSEIBANK = { /** * @module */ module: { /* ------------------------------------------- * @method opacityPng * ------------------------------------------- * @for IE8- * ------------------------------------------- */ opacityPng: function(){ if(SHINSEIBANK.utility.isIE8()){ $('img[src$="png"]').each(function(){ $(this).css({ "background": "transparent", "filter": 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + $(this).attr("src") + '", sizingMethod="scale");' }); }); } }, /* ------------------------------------------- * @method accordion * ------------------------------------------- * @param {String} targetClass * @param {String} dispType * @param {String} firstDisplay * @param {String} toggleBtnClass * @param {String} togglePanelClass * @param {String} switchClassName * @param {String} slideSpeed * ------------------------------------------- */ accordion: function (config) { var c = $.extend({ targetClass: ".accordion", dispType: "allHide", // 初期表示設定:"allHide" or "allShow" or "select" or "asideNav" firstDisplay: 0, // 初期表示対象 toggleBtnClass: ".acHead", // 開閉ボタン togglePanelClass: ".acContent", // 開閉パネル switchClassName: "open", // 切り替えクラス closeBtnClass: ".closeBtn", // 「閉じる」ボタン slideSpeed : 200 // スライドスピード }, config); if($(c.targetClass).length == 0){ return false; } /* vars ------------------------------- */ var $container = $(c.targetClass), toggleBtn = $(c.toggleBtnClass, $container), togglePanel = $(c.togglePanelClass, $container), targetBtn, targetPanel; /* settings ------------------------------- */ /* 初期表示設定 */ switch (c.dispType) { // 全非表示の場合 case "allHide": togglePanel.hide(); break; // 全表示の場合 case "allShow": toggleBtn.addClass(c.switchClassName); break; // 1つだけ表示する場合 case "select": toggleBtn.eq(c.firstDisplay).addClass(c.switchClassName); togglePanel.hide(); togglePanel.eq(c.firstDisplay).show(); break; default: break; } /* trigger ------------------------------- */ toggleBtn.each(function(){ $(this).click(function(){ var targetBtn = $(this), targetPanel = targetBtn.next(); targetBtn.toggleClass(c.switchClassName); targetPanel.slideToggle(c.slideSpeed); reRunPlugin(); }); }); /* 「閉じる」ボタン制御 */ $(c.closeBtnClass).on("click", "a", function(){ targetPanel = $(this).parents(c.togglePanelClass); targetBtn = targetPanel.prev(); targetPanel.slideUp(c.slideSpeed); targetBtn.removeClass(c.switchClassName); reRunPlugin(); }); function reRunPlugin(){ SHINSEIBANK.module.equalHeight(true); SHINSEIBANK.module.sizeFix({ targetClass: ".imgSet01", captionName: 'figcaption' }); } }, /* ------------------------------------------- * @method toggle * ------------------------------------------- * @param {String} targetClass * @param {String} toggleFlagName * @param {String} dispType * @param {String} firstDisplay * @param {String} toggleBtnClass * @param {String} togglePanelClass * @param {String} toggleText * @param {String} switchClassName * @param {String} controlBtnClass * @param {String} slideSpeed * ------------------------------------------- */ toggle: function (config) { var c = $.extend({ targetClass: ".toggleWrap01", toggleFlagName: "typeToggle", dispType: "allHide", // 初期表示設定:"allHide" or "allShow" or "select" firstDisplay: 0, // 初期表示対象 toggleBtnClass: ".toggleBtn", // 開閉ボタン togglePanelClass: ".toggleContent", // 開閉パネル toggleText: { txOpen: "開く", txClose: "閉じる" }, switchClassName: "active", // 切り替えクラス controlBtnClass: ".controlBtn", // 「制御」ボタン slideSpeed : 200 // スライドスピード }, config); if($(c.targetClass).length == 0){ return false; } /* vars ------------------------------- */ var $container = $(c.targetClass), $box = $("." + c.toggleFlagName, $container), toggleBtn = $(c.toggleBtnClass, $box), togglePanel = $(c.togglePanelClass, $box), targetBox, targetBtn, targetPanel; /* settings ------------------------------- */ /* 初期表示設定 */ switch (c.dispType) { // 全非表示の場合 case "allHide": if(togglePanel.hasClass("gmapWrap01")){ togglePanel.slideUp(); } else { togglePanel.hide(); } break; // 全表示の場合 case "allShow": $box.addClass(c.switchClassName); $box.find(c.toggleBtnClass).text(c.toggleText.txClose); break; // 1つだけ表示する場合 case "select": togglePanel.hide(); $box.eq(c.firstDisplay).addClass(c.switchClassName); $box.eq(c.firstDisplay).find(c.toggleBtnClass).text(c.toggleText.txClose); $box.eq(c.firstDisplay).find(c.togglePanelClass).show(); break; default: break; } /* trigger ------------------------------- */ /* 「トグル」ボタン */ toggleBtn.each(function(){ $(this).click(function(){ targetBox = $(this).parents("." + c.toggleFlagName); if(toggleBtn.hasClass("btnLink01")){ targetBtn = $("> a span", $(this)); } else { targetBtn = $(this); } targetPanel = targetBox.find(c.togglePanelClass); if(targetBox.hasClass(c.switchClassName)){ targetBtn.text(c.toggleText.txOpen); } else { targetBtn.text(c.toggleText.txClose); } targetBox.toggleClass(c.switchClassName); targetPanel.slideToggle(c.slideSpeed); }); }); /* 「制御」ボタン */ $(c.controlBtnClass).each(function(){ $(this).click(function(){ targetBox = $(this).parents("." + c.toggleFlagName); targetBtn = targetBox.find(c.toggleBtnClass); targetPanel = targetBox.find(c.togglePanelClass); if(targetBox.hasClass(c.switchClassName)){ targetBtn.text(c.toggleText.txOpen); targetBox.removeClass(c.switchClassName); targetPanel.slideUp(c.slideSpeed); } else { targetBtn.text(c.toggleText.txClose); targetBox.addClass(c.switchClassName); targetPanel.slideDown(c.slideSpeed); } }); }); }, /* ------------------------------------------- * @method tabSwitcher * ------------------------------------------- * @param {String} containerName * @param {String} noSwitchClassName * @param {String} naviClass * @param {String} btnClass * @param {String} panelClass * @param {String} currentClassName * @param {String} firstTarget * ------------------------------------------- */ tabSwitcher: function (config) { var c = $.extend({ containerName: ".tabWrap01", noSwitchName: "noSwitch", naviClass: ".tabNav", btnClass: ".tabLink", panelClass: ".tabPanel", currentClassName: "on", firstTarget: "" }, config); if($(c.containerName).length == 0){ return false; }/*else{ alert($(c.containerName).length); }*/ /* vars ------------------------------- */ var $elm = $(c.containerName).not("." + c.noSwitchName), tabNavi = $(c.naviClass, $elm), tabBtn = $(c.btnClass, tabNavi), tabPanel = $(c.panelClass, $elm), targetTab, firstTabName, tabName; return $elm.each(function(){ /* settings ------------------------------- */ targetTab = $(this); tabBtn = $(c.btnClass, targetTab); tabNavi = $(c.naviClass, targetTab); tabPanel = $(c.panelClass, targetTab); /* 初期表示 */ if(location.search.length > 1){ // URLにパラメータがある場合 function GetQueryString() { var result = {}; if( 1 < window.location.search.length ) { var query = window.location.search.substring( 1 ); var parameters = query.split( '&' ); for( var i = 0; i < parameters.length; i++ ) { var element = parameters[ i ].split( '=' ); var paramName = decodeURIComponent( element[ 0 ] ); var paramValue = decodeURIComponent( element[ 1 ] ); result[ paramName ] = paramValue; } } return result; } param = GetQueryString(); firstTabName = $('#' + param['tabID']).find(c.btnClass, c.naviClass).eq(param['tabNum']).find('a').attr('href'); }else{ // URLにパラメータがない場合 if($(c.firstTarget, targetTab).length){ // 初期表示タブに指定がある場合 firstTabName = c.firstTarget; } else { //firstTabName = tabBtn.find("li:first a").attr("href"); firstTabName = tabNavi.find("li:first a").attr("href"); } } //alert(firstTabName); tabBtn.find("a[href = '"+ firstTabName +"']").parent().addClass(c.currentClassName); tabPanel.show().not(firstTabName).hide(); /* trigger ------------------------------- */ /* 「タブボタン」クリック制御 */ //tabBtn.on("click", "a", function(){ tabNavi.on("click", "a", function(){ var self = $(this); if(self.hasClass(c.currentClassName)){ return false; } else { tabName = self.attr("href"); targetTab = self.parents(c.containerName); //tabBtn = $(c.btnClass, targetTab); tabBtn = $(c.naviClass, targetTab); tabPanel = $(c.panelClass, targetTab); tabBtn.find("li").removeClass(c.currentClassName); tabBtn.find("a[href = '"+ tabName +"']").parent().addClass(c.currentClassName); tabPanel.show().not(tabName).hide(); SHINSEIBANK.module.sizeFix({ targetClass: ".imgSet01", captionName: 'figcaption' }); SHINSEIBANK.module.equalHeight(true); return false; } }); }); }, /* ------------------------------------------- * @method rollover * ------------------------------------------- * @param {String} targetClass * @param {String} onSuffix * ------------------------------------------- */ rollover: function(config){ var c = $.extend({ targetClass: ".rollover", onSuffix: "on" }, config); if($(c.targetClass).length == 0 || SHINSEIBANK.utility.isNotPC()){ return false; } var src = { over: function($elm){return $elm.attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1" + c.onSuffix + "$2");}, out: function($elm){return $elm.attr("src").replace(new RegExp("^(.+)" + c.onSuffix + "(\.[a-z]+)$" ), "$1$2");}, preload: function($elm){return $elm.attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1" + c.onSuffix + "$2");} }; $(c.targetClass) .hover(function(){ $(this).attr("src", src.over($(this))); }, function(){ $(this).attr("src", src.out($(this))); }) .each(function(){ $("").attr("src", src.preload($(this))); }); }, /* ------------------------------------------- * @method opRollover * ------------------------------------------- * @param {String} targetClass * @param {String} opacity * @param {String} onSuffix * ------------------------------------------- */ opRollover: function(config){ var c = $.extend({ targetClass: ".opRollover", opacity: 0.8, onSuffix: "on" }, config); $(c.targetClass).hover( function(){ $(this).css("opacity", c.opacity).addClass(c.onSuffix); }, function(){ $(this).css("opacity", 1).removeClass(c.onSuffix); } ) }, /* ------------------------------------------- * @method smoothScroll * ------------------------------------------- * @param {String} pageUp * @param {String} fadeSpeed * @param {String} speed * @param {String} easing * @param {String} noScrollClass * ------------------------------------------- */ smoothScroll: function (config) { var c = $.extend({ pageUp: "#pageTop", fadeSpeed: 500, speed: 300, easing: "swing", noScrollClass: ".noScroll" }, config); /* vars ------------------------------- */ var url = $(location).attr("href"), hash = location.hash, $btn = $(c.pageUp), $win = $(window), $doc = $(document), href, position, tabHeight = 0, ua = navigator.userAgent.toLowerCase(), webkit = /webkit/; /* display ------------------------------- */ $win.scroll(function(){ var $pagetop = $('#pagetop'); if ($(this).scrollTop() > 1){ $pagetop.fadeIn(c.fadeSpeed); } else { $pagetop.fadeOut(c.fadeSpeed); } }); /* trigger ------------------------------- */ /* ページ遷移+アンカー移動制御(「タブ」の場合、遷移対象を開く) */ $win.load(function(){ if((url.indexOf("#anc") != -1) || (url.indexOf("#tab") != -1)){ target = $(hash); position = target.offset().top; } exception(); }); /* ハッシュがある場合 */ if(hash){ target = $(hash == "#" || hash == "" ? "html" : hash); position = target.offset().top; // アコーディオンパーツの見出しにアンカーリンクする場合 if($(hash).parent('.boxToggle02').length > 0){ $('.hdg', hash).trigger('click'); } exception(); scrolling(); } /* リンク */ $("a[href^=#]").not("a[href=#], a[href^=#tab], a[href^=#cb_inline], a.linkTxtHelp01, .tabKitBox .tabKitNav a, " + c.noScrollClass + "").click(function(){ href = $(this).attr("href"); target = $(href == "#" || href == "" ? "html" : href); position = target.offset().top; exception(); scrolling(); return false; }); function exception(){ if(href=="#page"){ position = 0; }else{ position = position/* - $('#header').outerHeight()*/; } } function scrolling(){ $(webkit.test(ua) ? "body" : "html").animate({ scrollTop: position - $('#header').outerHeight(true) }, c.speed, c.easing); } }, /* ------------------------------------------- * @method sizeFix * ------------------------------------------- * @param {String} targetClass * @param {String} baseClassName * @param {String} captionClass * ------------------------------------------- */ sizeFix: function (config) { var c = $.extend({ targetClass: ".sizeFix", baseClassName: "baseSize", captionName: ".txCaption" }, config); if($(c.targetClass).length == 0){ return false; } $(c.targetClass).each(function () { var w; if($(this).find("img").hasClass(c.baseClassName)){ w = $("." + c.baseClassName, this).width(); } else { w = $("img", this).width(); } $(c.captionName, this).css("width", w); $(this).css("width", w) }) }, /* ------------------------------------------- * @method linkExpand * ------------------------------------------- * @param {String} containerName * @param {String} addLinkClassName * ------------------------------------------- */ linkExpand: function (config) { var c = $.extend({ containerName: ".expandWrap", targetClass: ".expand", // 拡張対象に付与するクラス名 addBoxClassName: "expandBox", // 拡張したいリンク(タグ)に付与するクラス名 addLinkClassName: "expandLink", // 拡張したいリンク(タグ)に付与するクラス名 noLinkClass: ".noExpandLink" // 拡張させたくない対象に付与するクラス名 }, config); $(c.targetClass, $(c.containerName)).each(function(){ if($(this).find("a").length == 0){ return false; } /* vars ------------------------------- */ var $elm = $(this), href, // ジャンプするURL target; // target属性 /* trigger ------------------------------- */ $elm.not(c.noLinkClass).on({ /* click */ 'click': function() { var self = $(this); if($("*", self).children().hasClass(c.addLinkClassName)){ href = $(c.addLinkClassName, self).attr("href"); target = $(c.addLinkClassName, self).attr("target"); } else { href = self.find("a").attr("href"); target = self.find("a").attr("target"); } if(target){ window.open(href, target).focus(); } else { window.open(href, "_self"); } return false; }, /* マウスオーバー */ 'mouseenter': function() { $(this).addClass(c.addBoxClassName); }, /* マウスアウト */ 'mouseleave': function() { $(this).removeClass(c.addBoxClassName); } }); }); }, /* ------------------------------------------- * @method equalHeight * ------------------------------------------- * @param {Boolean} fsCheck * - 文字可変に対応するかどうか * ------------------------------------------- */ equalHeight: function(fsCheck){ var className = ".equalHeight", childBaseName = "equalChild", $elm = $(className), $children = $elm.children(), fsCheck = fsCheck || false; if($elm.length === 0 || $children.length < 2){ return false; } /* 各要素ごとにグループ化 */ var grouping = function(){ var $groupedChildren = $elm.find('*[class*=' + childBaseName + ']'), classNames = {},groups = []; $groupedChildren.each(function(){ var splitClass = $(this).attr("class").split(" "), splitClassNum = splitClass.length, newClassName; for(var i = 0; i < splitClassNum; i++){ newClassName = splitClass[i].match(RegExp(childBaseName + "[a-z0-9_-]+", 'i')); if(!newClassName){ continue; } else { newClassName.toString(); classNames[newClassName] = newClassName; } } }); for(var c in classNames){ groups.push($elm.find("." + c)); } groups.push($children); return groups; }; /* 各要素の高さを揃える */ var equalHeight = function(elm){ var maxHeight = 0; elm.css("height", "auto"); elm.each(function(){ if($(this).height() > maxHeight){ maxHeight = $(this).height(); } }); return elm.height(maxHeight); }; /* init */ var init = function(){ var groups = grouping(), h = [], child = [], maxHeight = 0, top = 0; $.each(groups, function(){ var $group = $(this); $group.each(function(i){ $(this).css("height", "auto"); h[i] = $(this).height(); if(top != $(this).position().top){ equalHeight($(child)); child = []; top = $(this).position().top; } child.push(this); }); }); if(child.length > 1){ equalHeight($(child)); } }; // 文字可変への対応可否 fsCheck ? SHINSEIBANK.utility.isFontSizeCheck(init) : init(); }, /* ------------------------------------------- * @method popup * ------------------------------------------- */ popup: function(config){ var c = $.extend({ elm: '.popup', name: "POPUP", height: 600, width: 600, toolbar: 0, menubar: 0, scrollbars: 1, status: 0, location: 0, resizable: 1, left: 0, top: 0, center: true }, config); var $elm = $(c.elm), parameters; if($elm.length === 0){ return false; } if(c.center){ c.top = (screen.height - c.height) / 2; c.left = (screen.width - c.width) / 2; } parameters = "height=" + c.height + ",width=" + c.width + ",toolbar=" + c.toolbar + ",menubar=" + c.menubar + ",scrollbars=" + c.scrollbars + ",status=" + c.status + ",location=" + c.location + ",resizable=" + c.resizable + ",left=" + c.left + ",screenX=" + c.left + ",top=" + c.top + ",screenY=" + c.top; $elm.click(function(){ window.open(this.href, name, parameters); return false; }) }, /* ------------------------------------------- * @method gmap * ------------------------------------------- */ gmap: function(config){ /** * @user option */ var c = $.extend({ flameIdName: "#gmapFlame", windowIdName: "#gmapWindow", dispkayIdName: "#gmapDisplay", width: 600, height: 400, zoom: 15, // 0~19 icon: "", title: "", latitude: "", //緯度 longitude: "" //経度 }, config); var $flame = $(c.flameIdName); if($flame.length == 0){ return false; } $flame.each(function(){ var $window = $(c.windowIdName, this), $display = $(c.dispkayIdName, this); /** * 初期設定 */ $display.css({ width: c.width, height: c.height }) $window.hide(); /** * 基本設定 */ var box = $display.get(0), myOptions = { zoom: c.zoom, center: new google.maps.LatLng(c.latitude,c.longitude), mapTypeId: google.maps.MapTypeId.ROADMAP, scaleControl: true }, map = new google.maps.Map(box, myOptions); /** * マーカー設定 */ var marker = new google.maps.Marker({ position: new google.maps.LatLng(c.latitude,c.longitude), map: map, icon: (c.icon) ? c.icon : "", title: c.title }); /** * 情報ウィンドウ設定 */ var content = $window.css("width", 300).get(0), infowindow = new google.maps.InfoWindow({ content: content }); /** * clickで表示 */ google.maps.event.addListener(marker, "click", function(){ $window.show(); infowindow.open(map, marker); }); }); }, /* ------------------------------------------- * @method placeholder01 * ------------------------------------------- */ placeholder01: function(config){ /** * @user option */ var c = $.extend({ phTarget: '.placeholder', phText : '入力してください', phClass : 'onPlaceholder' }, config); if($(c.phTarget).length == 0){ return false; } $(c.phTarget).each(function() { /** * vars */ var self = $(this), form = self.closest('form'); /* init */ if(self.val() === '' || self.val() === c.phText) { self.val(c.phText) .addClass(c.phClass); }; /* focus/blur */ self.live({ focus: function() { if(self.val() === c.phText) { self.val('') .removeClass(c.phClass); }; }, blur: function() { if(self.val() === '') { self.val(c.phText) .addClass(c.phClass); }; } }); /* submit */ form.submit(function() { // サブミット時、何も入力されていなければ空に if(self.val() === c.phText) { self.val(''); }; }); }); }, /* ------------------------------------------- * @method placeholder02 * ------------------------------------------- */ placeholder02: function(config){ /** * @user option */ var c = $.extend({ phTarget: '.placeholder', phText : '入力してください', phClass : 'onPlaceholder' }, config); if($(c.phTarget).length == 0){ return false; } $(c.phTarget).each(function() { /** * vars */ var self = $(this), form = self.closest('form'), phText; /* setting */ if(self.attr('title') != 'undefined') { phText = self.attr('title'); }else{ phText = c.phText; } /* init */ if(self.val() === '' || self.val() === phText) { self.val(phText).addClass(c.phClass); }; /* focus/blur */ self.on({ focus: function() { if(self.val() === phText) { self.val('').removeClass(c.phClass); }; }, blur: function() { if(self.val() === '') { self.val(phText).addClass(c.phClass); }; } }); /* submit */ form.submit(function() { // サブミット時、何も入力されていなければ空に if(self.val() === phText) { self.val(''); }; }); }); }, /* ------------------------------------------- * @method navLocation * ------------------------------------------- */ navLocation: function(){ var classOn = 'on'; path = (location.pathname.replace('index.html', '')), paths = (path.split("/")), pathLen = (paths.length - 1); // #navGlobal if(paths[1] != ''){ // 各カテゴリ $('#navGlobal ul li').find('> a[href^="' + '/' + paths[1] + '/' + '"]').closest('li').addClass(classOn); }else{ // サイトトップ $('#navGlobal ul li').find('> a[href="/"]').closest('li').addClass(classOn); } // #navLocal if($('#navLocal > ul').length > 0){ // カテゴリがない場合 if(paths[1] != ''){ $('#navLocal > ul > li').find('> a[href^="' + '/' + paths[1] + '"]').closest('li').addClass(classOn); } }else{ // カテゴリがある場合 if(paths[2] != ''){ $('#navLocal > dl > dd > ul > li').find('> a[href^="' + '/' + paths[1] + '/' + paths[2] + '"]').closest('li').addClass(classOn); } if(paths[3] != ''){ $('#navLocal > dl > dd > ul > li > ul > li').find('> a[href^="' + '/' + paths[1] + '/' + paths[2] + '/' + paths[3] + '"]').closest('li').addClass(classOn); } if(paths[4] != ''){ $('#navLocal > dl > dd > ul > li > ul > li > ul > li').find('> a[href^="' + '/' + paths[1] + '/' + paths[2] + '/' + paths[3] + '/' + paths[4] + '"]').closest('li').addClass(classOn); } } }, /* ------------------------------------------- * @method copyrightAddYear * ------------------------------------------- */ copyrightAddYear: function(config){ var year = new Date().getFullYear(); $('#footer #copyright').html($('#footer #copyright').html().replace('©', '© ' + year)); }, /* ------------------------------------------- * @method tooltip * ------------------------------------------- */ tooltip: function(config){ /** * @user option */ var c = $.extend({ target: '.linkTxtHelp01', slideSpeed: 200 }, config); if(c.target.length == 0){ return false; } $(c.target).click(function(){ $($(this).attr('href')).slideToggle(c.slideSpeed); return false; }); }, /* ------------------------------------------- * @method header01 * ------------------------------------------- */ header01: function(config){ if($('.headerType01').length == 0){ return false; } var speed = 400; var classOpen = 'open'; // ヘッダの高さ分、div#pageに余白を設定 // Androidの高さ不具合対策 $('#page').css('padding-top', $('#header').outerHeight(true)); // 下地の作成 $('#page').append('
'); // メニューを開く $('#page').on('click', '#header01 .menu01, #navGlobal01 .close, #cover', function(){ // メニューの表示 $('#navGlobal01').animate({ height: 'toggle', opacity: 'toggle' }, speed, function(){ if($('#navGlobal01').is(':visible')){ $('#body').addClass(classOpen); $('.headerType01 #page').css('padding-top', '0'); $('.headerType01 #page #header').css('position', 'relative'); }else{ $('#body').removeClass(classOpen); $('.headerType01 #header').css('position', 'fixed'); $('.headerType01 #page').css('padding-top', $('#header').outerHeight(true)); } }); // ページ上部へ移動 $('#pagetop a').trigger('click'); }); }, /* ------------------------------------------- * @method header02 * ------------------------------------------- */ header02: function(config){ if($('.headerType02').length == 0){ return false; } var speed = 200; var classOpen = 'open'; // 下地の作成 $('#page').append('
'); /*$('#cover').css({ height: $('#page').outerHeight(true) });*/ // メニューを開く $('#page').on('click touchmove', '#header01 .menu02, #navGlobal02 .close01, #navGlobal02 .close02, #cover', function(){ // ページ上部へ移動 $('#pagetop a').trigger('click'); // メニューの表示 if($('.headerType02 #page').css('margin-left') == '0px'){ $('#body').addClass(classOpen); $('#page').animate({ 'margin-left': '90%' }, speed); $('#pagetop').animate({ right: - $('#pagetop').outerWidth(true) }, speed); }else{ $('#body').removeClass(classOpen); $('.headerType02 #page').animate({ 'margin-left': 0 }, speed); $('#pagetop').css('right', 0); } }); } }, /** * @utility */ utility: { /* ------------------------------------------- * @method isNotPC * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isNotPC: function(){ var UA = ["iPhone","iPad","Android"], uaArray = new RegExp(UA.join("|"),"i"); return uaArray.test(navigator.userAgent); }, /* ------------------------------------------- * @method isSmartPhone * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isSmartPhone: function(){ var ua = navigator.userAgent.toLowerCase(); var UA = { iPhone: ua.indexOf('iphone') != -1, iPod: ua.indexOf('ipod') != -1, Android: ua.indexOf('android') != -1 && ua.indexOf('mobile') != -1 } return (UA.iPhone | UA.iPod | UA.Android) ? true : false; }, /* ------------------------------------------- * @method isTablet * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isTablet: function(){ var ua = navigator.userAgent.toLowerCase(); var UA = { iPad: ua.indexOf('ipad') != -1, Android: ua.indexOf('android') != -1 && ua.indexOf('mobile') == -1 } return (UA.iPad || UA.Android) ? true : false; }, /* ------------------------------------------- * @method isAndroid * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isAndroid: function(){ var ua = navigator.userAgent.toLowerCase(); return (ua.indexOf("android") != -1) ? true : false; }, /* ------------------------------------------- * @method isIE * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isIE: function(){ var ua = navigator.userAgent.toLowerCase(); return (ua.indexOf("msie") != -1) ? true : false; }, /* ------------------------------------------- * @method isIE8 * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isIE8: function(){ var ua = navigator.userAgent.toLowerCase(); return (ua.indexOf("msie 8") != -1) ? true : false; }, /* ------------------------------------------- * @method isIE9 * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isIE9: function(){ var ua = navigator.userAgent.toLowerCase(); return (ua.indexOf("msie 9") != -1) ? true : false; }, /* ------------------------------------------- * @method isIE10 * ------------------------------------------- * @return {Boolean} * ------------------------------------------- */ isIE10: function(){ var ua = navigator.userAgent.toLowerCase(); return (ua.indexOf("msie 10") != -1) ? true : false; }, /* ------------------------------------------- * @method isUA * ------------------------------------------- * @return {String} ユーザーエージェント * ------------------------------------------- */ isUA: function(){ return navigator.userAgent; }, /* ------------------------------------------- * @method isFontSizeCheck * ------------------------------------------- * @param {function} callback * - フォントサイズが変更されたら、callbackを実行 * ------------------------------------------- */ isFontSizeCheck: function(callback){ var HTML_FS_WATCH = $('
 
'), CSS_OBJECT = { display: "block", visibility: "hidden", position: "absolute", top: "0", padding: "0" }, $elm, interval = 500, currentSize = 0; // 監視用HTMLを生成する HTML_FS_WATCH.css(CSS_OBJECT).appendTo("body"); $elm = $("#fontSizeWatcher"); // 要素の高さを取得 var getSize = function($elm){ return $elm.height(); }; // 要素の高さを比較して、異なればcallbackを実行 var fontSizeCheck = function(){ var h = getSize($elm); if(h === currentSize){ return false; } else { currentSize = h; callback(); } }; setInterval(fontSizeCheck, interval); }, /* ------------------------------------------- * @method isWindowSizeCheck * ------------------------------------------- * @param {function} callback * - windowのリサイズ処理が完了したら、callbackを実行 * ------------------------------------------- */ isWindowSizeCheck: function(callback){ var resize = false, interval = 500; this.$(window).bind("resize", function(){ // リサイズされている間は、何もしない if(resize !== false){ clearTimeout(resize); } resize = setTimeout(function(){ callback(); }, interval); }); } } }