/********************************************* * footer02.js --------------------------------------------- * @noConflict * - j$ * @respondBrowser * - IE8 @init @plugin * - pcMenuControl * - spMenuControl *********************************************/ /* ------------------------------------------- * @noConflict ------------------------------------------- */ jqNew = jQuery.noConflict(); if($ === undefined){ $ = jQuery; } j$ = jQuery || jqNew; /* ------------------------------------------- * @respondBrowser * IE8以下の時にSP用CSSを削除 * media-queryを理解しないため ------------------------------------------- */ var ua = navigator.userAgent.toLowerCase(); if((ua.indexOf("msie 8") !== -1) || (ua.indexOf("msie 7") !== -1) || (ua.indexOf("msie 6") !== -1)){ j$('link[media="all and (max-width: 750px)"]').remove(); } /* ------------------------------------------- * @init ------------------------------------------- */ j$(function(){ // SP幅判定 isRangeSP = function(){ var winW = j$(window).width(); return (winW <= 750) ? true : false; }; // SP幅の時に実行 if(isRangeSP()){ j$("[id*='footerContainer'] .navToggle > li").navigationToggle(); } // 幅可変時に実行 var winChangeLoad = function(){ var resize = false, interval = 500; j$(window).on("resize", function(){ // リサイズされている間は何もしない if(resize !== false){ clearTimeout(resize); } resize = setTimeout(function(){ j$.equalHeight(); }, interval); }); }; winChangeLoad(); }); // load時に実行 j$(window).on("load",function(){ j$.equalHeight(); }); /* ------------------------------------------- * @plugin ------------------------------------------- */ (function(j$){ /* * @method equalHeight * - 高さ揃え */ j$.equalHeight = function(config){ var c = j$.extend({ className: ".hdft_eqHeight", childBaseName: "equalChild" }, config); if(j$(c.className).length == 0) return false; /* vars ------------------------------- */ var $this = j$(c.className), $children = $this.children(), $childName = j$("." + c.childBaseName), num_$children = $children.size(), arr_parents = []; if(num_$children < 2) return false; function ChildrenGrouping(){ var arr_groups = [], $children = $this.find($childName); if($children.length) arr_groups.push($children); var $groupedChildren = $this.find('*[class*=' + c.childBaseName + ']:not(.' + c.childBaseName + ')'); if($groupedChildren.length){ var classNames = {}; $groupedChildren.each(function(){ var split_class = j$(this).attr("class").split(" "), len_split_class = split_class.length, i, new_class; for(i = 0; i < len_split_class; i++){ new_class = split_class[i].match(RegExp(c.childBaseName + "[a-z0-9_-]+", 'i')); if(!new_class) continue; new_class = new_class.toString(); if(new_class) classNames[new_class] = new_class; } }); for(var new_class in classNames) arr_groups.push($this.find("." + new_class)); } $children = $this.children(); if($children.length) arr_groups.push($children); $this.data("EqualHeightChildrenGroups", arr_groups); arr_parents.push($this); return arr_groups } j$.fn.EqualHeight = function(){ var maxHeight = 0; this.css("height", "auto"); // IE用 this.css("zoom", 1); this.each(function(){ if (j$(this).height() > maxHeight) { maxHeight = j$(this).height(); } }); return this.height(maxHeight) }; j$.fn.EqualHeightInit = function(){ var arr_groups = ChildrenGrouping(); j$.each(arr_groups, function(){ var $children = j$(this), arr_child = [], top = 0; $children.each(function(){ if(top != j$(this).position().top){ j$(arr_child).EqualHeight(); arr_child = []; top = j$(this).position().top; } arr_child.push(this); }); if(arr_child.length) j$(arr_child).EqualHeight(); }); }; /* 初期表示 */ $this.EqualHeightInit(); }; /* * @plugin - navigationToggle */ j$.fn.navigationToggle = function(config){ var c = j$.extend({ childList: ".navList02", speed: 300, openNm: "open" },config); // vars var self = j$(this), $trg = self.children("a"); // setting j$(this).find(c.childList).hide(); // trigger $trg.on("click",function(){ var self = j$(this).parents("li"), $childList = self.find(c.childList); if($childList.length === 0){ return; } if(self.hasClass(c.openNm)){ self.removeClass(c.openNm); $childList.stop().slideUp(c.speed); return false; } else { self.addClass(c.openNm); $childList.stop().slideDown(c.speed); return false; } }); // PCのみ領域外クリック if(!isRangeSP()){ if(navigator.userAgent.toLowerCase().indexOf('ipad') > 0){ j$("body").css("cursor","pointer"); } j$(document).on("click",function(){ $trg.parents("li").removeClass(c.openNm); $trg.parents("li").find(c.childList).stop().slideUp(c.speed); }); j$("#menuWrap .globalNav01 .navList01 > li > a").on("click",function(){ $trg.parents("li").removeClass(c.openNm); $trg.parents("li").find(c.childList).stop().slideUp(c.speed); }); $trg.on("click",function(e){ e.stopPropagation(); }); } }; })(jQuery);