/*タブ切り替え ----------------------------------------------------*/ function jsTabs(){ var u = new EPOS_CARD.Util(); var G_fixTabHeight = 64; var showTab; var webkit = /webkit/; //タブ切り替え本体 var c = j$.extend({ tabName: ".jsTabContents", tablist: ".jsTabList", boxName: ".jsTabDetail", openClass : "active", escapeClass : "noTabLink" }); var j$elm = j$(c.tabName); if(j$elm.length === 0){ return false; } j$elm.each(function(){ var j$this = j$(this), j$list = j$(c.tablist, j$this), j$box = j$(c.boxName, j$this); // 初期表示 j$box.hide(); // ハッシュ制御 var myHash = location.hash; myHash = myHash.split(/[?&]/)[0]; if(myHash.indexOf("tab")){ var $hashTarget = j$('.jsTabList').find('a[href^="' + myHash + '"]').parent("li"); $hashTarget2 = j$(".fixdAncList").find('a[href^="' + myHash + '"]'); if($hashTarget.length > 0){ if(!u.isRangeSP()){ var parentID = $hashTarget.parent('.jsTabList').attr("id"); var dataName = $hashTarget.parents(c.tablist).attr("data-ancnum"); j$(dataName).addClass("isOpen"); $hashTarget.addClass('active'); $hashTarget2.addClass('isActive'); var ancPoint = $("#" + parentID).offset().top; setTimeout(function(){ j$("html, body").animate({ scrollTop: ancPoint }, 500); },100); } else { var parentID = location.hash; parentID = parentID.split(/[?&]/)[0]; var dataName = $hashTarget.parents(c.tablist).attr("data-ancnum"); j$(dataName).addClass("isOpen"); $hashTarget.addClass('active'); $hashTarget2.addClass('isActive'); var ancPoint = j$(".jsTabList.spOnly").find('a[href^="' + parentID + '"]').offset().top; setTimeout(function(){ j$("html, body").animate({ scrollTop: ancPoint }, 500); },100); } } } j$('li.active a', c.tablist).each(function(){ showTab = j$(this).attr("href"); j$(showTab).show(); }); j$list.on('click', 'li', function() { if(j$(this).is('.' + c.escapeClass)) {return false;} var dataName = $(this).parents(c.tablist).attr("data-ancnum"); if(j$(this).hasClass(c.openClass)) { j$(this).removeClass("active"); j$(dataName).removeClass("isOpen"); j$box.hide(); } else { EPOS_CARD.module.equalHeight(true, true); if(!u.isRangeSP()){ var href = j$("a", this).attr("href"); j$(this).removeClass("active"); j$list.children().removeClass(c.openClass); j$(this).addClass(c.openClass); j$box.hide(); j$(dataName).addClass("isOpen"); j$("a",dataName).removeClass("isActive"); j$("a",dataName).each(function(){ if(j$(this).attr("href")===href){ j$(this).addClass("isActive"); } }); j$(href).show(); } else { var href = j$("a", this).attr("href"); j$list.children().removeClass(c.openClass); j$(this).addClass(c.openClass); j$box.hide(); j$(href).show(0,function(){ var openScroll = j$(href).offset().top; setTimeout(function(){ $('body,html').animate({scrollTop:openScroll},500); },100); }); } return false; } }); }); /*タブ内アンカー ----------------------------------------------------*/ $(".jsAncList li a").click(function(eo){ var $targetPoint = $(this).attr("href"); var openScroll = $($targetPoint).offset().top; setTimeout(function(){ $('body,html').animate({scrollTop:openScroll - G_fixTabHeight+1},500); },100); eo.preventDefault(); }); /*タブ内固定アンカー ----------------------------------------------------*/ function fixtab(){ var topCount = $(window).scrollTop(); var $elm = (".fixdAncList"); var $fixElm01 = $("#fixdAncList01"); var $fixElm02 = $("#fixdAncList02"); if(!$elm.length){ return false;} $(window).scroll(function(){ topCount = $(window).scrollTop(); var breakpos01 =$("#jsAncKey01").offset().top + $("#jsAncKey01").height()-G_fixTabHeight; var breakpos02 =$("#jsAncKey02").offset().top + $("#jsAncKey02").height() -G_fixTabHeight; //fixNav1 if(topCount>=breakpos01){ $fixElm01.addClass("isActive"); }else{ $fixElm01.removeClass("isActive"); } //fixNav2 if(topCount>=breakpos02){ $fixElm02.addClass("isActive"); }else{ $fixElm02.removeClass("isActive"); } }); //クリック時の処理 $("a",$elm).click(function(){ $("a",$elm).removeClass("isActive"); $(this).addClass("isActive"); var openTarget =$(this).attr("href"); $(".jsTabDetail").not(openTarget).hide(); //タブボタンのon体裁を消す $(".jsTabList > li").removeClass("active"); $(".jsTabList > li").each(function() { if($(this).find("a").attr("href") === openTarget) { $(this).addClass("active"); } }); //遷移 $(openTarget).show(0,function(){ var openScroll = $(openTarget).offset().top; setTimeout(function(){ $('body,html').animate({scrollTop:openScroll - G_fixTabHeight+1},500); },100); }); }); } fixtab(); } /*タブ内タブ ----------------------------------------------------*/ function jsInnerTabs(){ var u = new EPOS_CARD.Util(); //タブ切り替え本体 var $elm = $(".innerTabContentsBox"); if($elm.length === 0){ return false; } $elm.each(function(){ var self = $(this), tabBtns = $(".secondTab_area li", self), tabItem = $(".secondTab_panel_area .tab_panel", self), openClass = "active"; var activeIndex = 0; if($(".secondTab_area li.active", self).length !==0){ activeIndex = $(".secondTab_area li.active", self).index(); } tabBtns.eq(activeIndex).addClass(openClass); tabItem.eq(activeIndex).addClass(openClass); $(tabBtns).click(function(){ if($(this).hasClass(openClass)){ tabBtns.removeClass(openClass); tabItem.removeClass(openClass); } else { tabBtns.removeClass(openClass); tabItem.removeClass(openClass); var tabClass = $(this).attr('class'); $(this).addClass(openClass); tabItem.each(function(){ if($(this).attr('class').indexOf(tabClass) !== -1){ $(this).addClass(openClass); } }); } }); }); } /*要素追加表示 ----------------------------------------------------*/ function jsMoreItem(){ var u = new EPOS_CARD.Util(); var $elm = $(".innerTabContentsBox"), $moreList = $(".innerTabContentsBox .tab_panel"), $moreBtn = $(".secondTabMoreBtn"); if($elm.length === 0){ return false; } $($moreList).each(function(){ var num = $(this).find(".btnList01 li").length; if(!u.isRangeSP()){ if(num >= 9){ $(this).find(".btnList01 li:nth-child(n+9)").addClass("hide"); $(this).find($moreBtn).show(); } $moreBtn.on("click",function(){ $(this).prev(".btnList01").find("li").removeClass("hide"); $(this).hide(); EPOS_CARD.module.equalHeight(true, true); }); } else { if(num >= 7){ $(this).find(".btnList01 li:nth-child(n+7)").addClass("hide"); $(this).find($moreBtn).show(); } $moreBtn.on("click",function(){ $(this).prev(".btnList01").find("li").removeClass("hide"); $(this).hide(); EPOS_CARD.module.equalHeight(true, true); }); } }); } /*タブ内モーダル ----------------------------------------------------*/ function jsInnerTabModal(){ var u = new EPOS_CARD.Util(); //タブ切り替え本体 var $elm = $(".innerTabContentsBox"), $modalBtns = $(".secondTabModal a"); if($elm.length === 0){ return false; } if(!u.isRangeSP()){ $modalBtns.colorbox({ inline: true, innerWidth: "auto", innerHeight: "auto", maxWidth: "100%", maxHeight: "100%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); } }); } else { $modalBtns.colorbox({ inline: true, width: "98%", innerHeight: "auto", maxHeight: "100%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); } }); } EPOS_CARD.module.equalHeight(true, true); } //パラメータによって初期表示でモーダルを起動する。 function execution_load_jsInnerTabModal(){ var param = location.search, paramArr = [], marchtext01 = "osakagas_modal=true", tagetModalId = "secondTabModal04_06"; if(param.length === 0){ return false; } paramArr = param.split(/[?&]/); for(var i=0; i<=paramArr.length; i++){ if(paramArr[i] === marchtext01){ $('.secondTabModal a[href^="#'+ tagetModalId +'"]').click(); break; } } } /*スライダー ----------------------------------------------------*/ function heroSlider(){ var u = new EPOS_CARD.Util(); // vars var $wrap = j$("#heroSlider02"), $slides = $wrap.find(".slides"), $slideElm = $slides.children("div"), slideLen = $slideElm.length, initialWin = u.$win.width(), activeNm = "active"; if(slideLen < 2){ return false; } // slider settting var slideSet__pc = { // PC幅のスライダー設定 slideWidth: 920, minSlides: 1, maxSlides: 1, auto: true, pager: true, controls: true, speed: 1000, pause: 5000, prevText: '', nextText: '', onSliderLoad: function(currentIndex){ $slideElm.eq(currentIndex).addClass(activeNm); j$(".bx-clone").removeAttr("id"); $wrap.addClass('hero_complete'); }, onSlideAfter: function(currentIndex){ slider.startAuto(); $slideElm.removeClass(activeNm); j$(currentIndex).addClass(activeNm); } }, slideSet__sp = { // SP幅のスライダー設定 auto: true, pager: true, controls: true, speed: 1000, pause: 5000, prevText: '', nextText: '', onSliderLoad: function(currentIndex){ $slideElm.eq(currentIndex).addClass(activeNm); j$(".bx-clone").removeAttr("id"); $wrap.addClass('hero_complete'); }, onSlideAfter: function(currentIndex){ slider.startAuto(); $slideElm.removeClass(activeNm); j$(currentIndex).addClass(activeNm); } }, slideSet = (u.isRangeSP())? slideSet__sp:slideSet__pc; // slide init var slider = $slides.bxSlider(slideSet); // リサイズ時に幅を判定してスライダー設定を分岐 u.isWindowSizeCheck(function(){ var resizeWin = u.$win.width(); if(resizeWin === initialWin){ return false; } else { slideSet = (u.isRangeSP())? slideSet__sp:slideSet__pc; slider.reloadSlider(slideSet); initialWin = resizeWin; } }); } /*floating ----------------------------------------------------*/ function floating(){ var c = j$.extend({ typeLogout: ".floatingBtn.login", typeLogIn: ".floatingBtn.logout", expiration: 60 // 有効期限(日) }); // cookie取得関数 function getCookie(c_name){ var st = ""; var ed = ""; if(document.cookie.length>0){ // クッキーの値を取り出す st = document.cookie.indexOf(c_name + "="); if(st !== -1){ st = st+c_name.length+1; ed = document.cookie.indexOf(";",st); if(ed === -1) { ed=document.cookie.length; } // 値をデコードして返す return unescape(document.cookie.substring(st,ed)); } } return ""; } /* vars -------------------------------------------------- */ var $target_Out = $(".floatingBtn.login"), $target_In = $(".floatingBtn.logout"); if($target_Out.length === 0){ return false; } $target_Out.hide(); $target_In.hide(); /* 会員cookieが無ければログアウトバナーを表示 */ if(getCookie("esc_if") === ""){ $target_Out.show(); } else { $target_In.show(); } }; function floatingControlHasCookie(){ // vars var u = new EPOS_CARD.Util(); var $pageContainer = j$("#pageContaine"), $elm = j$('[id*="floatingWrap"]'), closeNm = "floatingNone", $close = j$(".floatingClose"), $toggleElm = j$(".floating-toggle"); if($elm.length === 0){ return false; } // close if($close.length !== 0){ $close.on("click",function(){ if($elm.hasClass(closeNm)){ j$.cookie("floatingDisplay","hide", {path: "/shopping" }); } else { j$.cookie("floatingDisplay","show", {path: "/shopping" }); } }); } // load u.$win.on("load", function(){ if(j$.cookie("floatingDisplay") == "hide"){ $elm.addClass(closeNm); $toggleElm.hide(); } }); }; function floatingControlHasParam(){ // vars var u = new EPOS_CARD.Util(); var $pageContainer = j$("#pageContaine"), $elm = j$('.paramChangeBanner_replacement'), $normalElm = j$('.paramChangeBanner_normal'), paramText = 'public_fee_banner=true', $modalBtns = $('.floatingModalBtn'); if($elm.length === 0){ return false; } var getParam = location.search; if(getParam.match(paramText)){ $normalElm.remove(); }else{ $elm.remove(); } //if($modalBtns.length !== 0){ if(!u.isRangeSP()){ $modalBtns.colorbox({ inline: true, innerWidth: "auto", innerHeight: "auto", maxWidth: "100%", maxHeight: "100%", fixed: true }); } else { $modalBtns.colorbox({ inline: true, width: "98%", innerHeight: "auto", maxHeight: "100%", fixed: true }); } //} }; /*modal ----------------------------------------------------*/ function modal(config){ // vars var $elm = j$(".js-modalItem"); if($elm.length === 0){ return false; } var c = j$.extend({ customClose: ".cb_close", CLOSE_HTML: '

閉じる

' },config); if(u.isRangeSP()){ $elm.colorbox({ iframe: true, innerWidth:"95%", innerHeight: 250, maxWidth: "95%", maxHeight: "98%", fixed: true, className: "cb-ytWrap", closeButton: false, onComplete: function(){ j$(c.CLOSE_HTML).appendTo("#colorbox.cb-ytWrap #cboxLoadedContent"); }, onClosed: function(){ j$("#ytClose").remove(); } }); } else { $elm.colorbox({ iframe: true, innerWidth:640, innerHeight:418, maxWidth: "100%", maxHeight: "100%", fixed: true, className: "cb-ytWrap", closeButton: false, onComplete: function(){ j$(c.CLOSE_HTML).appendTo("#colorbox.cb-ytWrap #cboxWrapper"); }, onClosed: function(){ j$("#ytClose").remove(); } }); } } /*scrollAnimation ----------------------------------------------------*/ function scrollAnimation() { const $elm = $('.js-scrollAnimation'); const AnimationClass = 'isAnimation'; if ($elm.length === 0) { return false; } u.$win.on('scroll', function () { const windowHeight = u.$win.height(); const scrollAmount = u.$win.scrollTop(); $elm.each(function () { if(!$(this).hasClass(AnimationClass)) { const targetPosition = $(this).offset().top; let adjust = 200 * (windowHeight / 1080) if(!u.isRangeSP()) { adjust = 400 * (windowHeight / 1080); } if (scrollAmount > targetPosition - windowHeight + adjust) { $(this).addClass(AnimationClass); } } }); }); } /*modalAdjust ----------------------------------------------------*/ function modalAdjust() { const $elm = $('.cboxElement'); if ($elm.length === 0) { return false; } if(u.isRangeSP()){ $elm.colorbox({ innerWidth: "auto", innerHeight: "auto", width: "100%", maxWidth: "100%", maxHeight: "100%", fixed: true }); } } /*init ----------------------------------------------------*/ //DOM Init j$(function(){ jsMoreItem(); jsInnerTabModal(); floatingControlHasCookie(); floatingControlHasParam(); scrollAnimation(); modalAdjust(); }); //LOAD Init j$(window).load(function(){ jsInnerTabs(); jsTabs(); heroSlider(); floating(); execution_load_jsInnerTabModal(); modal(); });