$(window).on('load',function(){ var menuIconH = $(".menuIcon").height(); var winH = $("#wrap-all").height(); var winW = $(window).width(); fix(); footerLine(); resizeAction(); $("#nav-wrap2 ul").css("marginTop",menuIconH); $("#nav-wrap2 ul").css("width",winW); $("#nav-wrap2 ul").hide(); $("#bgB").css("height",winH); $("#bgB").css("width",winW); $("#bgB").hide(); $(".menuIcon").click(function(event) { var MenuOpacity = parseInt($('.menuIcon img').css('opacity')); if (MenuOpacity == 1) { // 表示されている場合の処理 $(".menuIcon img").css("opacity",0); $(".menuIcon").css("background","url(/common/img/sp_menu_btn_bg.gif) repeat scroll top left"); $(".menuIcon").css("background-size","contain"); } else { // 非表示の場合の処理 $(".menuIcon img").css("opacity",1); $(".menuIcon").css("background","#fff"); } $("#bgB").css("opacity",0.8); $("#bgB").slideToggle(500); $("#nav-wrap2 ul").fadeToggle(500); return false; }); $("#bgB").click(function(event) { $(".menuIcon img").css("opacity",1); $(".menuIcon").css("background","#fff"); $("#bgB").slideToggle(500); $("#nav-wrap2 ul").fadeToggle(500); return false; }); /* $("#nav-wrap2 ul").click(function(event) { $("#bgB").slideToggle(500); $("#nav-wrap2 ul").fadeToggle(500); return false; }); */ $(window).resize(function() { resizeAction(); H_CHK(); footerLine(); }); //fix function fix(){ $("header").addClass("fixed"); $("#nav-wrap2").addClass("fixed"); $("#bgB").addClass("fixed"); $("header").css("z-index","200"); $("#bgB").css("z-index","300"); $("#nav-wrap2").css("z-index","500"); } function resizeAction(){ var headerH = $("header").height(); /* alert("test"); console.log("headerH = "+headerH); $("header").css("opacity",0.5); $("body").css("background","#FFCC00"); $(".main-container").css("background","#FFf"); $("header").css("background","#000"); */ $(".main-container").css("margin-top",headerH+5); $("header").css("z-index","200"); $("#bgB").css("z-index","300"); $("#nav-wrap2").css("z-index","500"); var menuIconH = $(".menuIcon").height(); $("#nav-wrap2 ul").css("marginTop",menuIconH); var winH = $("#wrap-all").height(); var winW = $(window).width(); $("#nav-wrap2 ul").css("width",winW); $("#bgB").css("height",winH); $("#bgB").css("width",winW); } function resizeAction2(){ var headerH = $("header").height(); /**/ console.log("headerH = "+headerH); $("header").css("opacity",0.5); $("body").css("background","#FFCC00"); $(".main-container").css("background","#FFf"); $("header").css("background","#000"); $(".main-container").css("margin-top",headerH); $("header").css("z-index","200"); $("#bgB").css("z-index","300"); $("#nav-wrap2").css("z-index","500"); var menuIconH = $(".menuIcon").height(); $("#nav-wrap2 ul").css("marginTop",menuIconH); var winH = $("#wrap-all").height(); var winW = $(window).width(); $("#nav-wrap2 ul").css("width",winW); $("#bgB").css("height",winH); $("#bgB").css("width",winW); } function H_CHK(){ var h = $(window).height(); var headerH = $('#nav-wrap2 ul').height()+$('.menuIcon').height(); if(headerH > h){ $('#nav-wrap2 ul').css('height',h-$('.menuIcon').height()); } else { $('#nav-wrap2 ul').css('height',"auto"); } } function footerLine(){ var logoH = $("#logoImg").height(); var txtH = $("#foot-desc").height(); var winW = $(window).width(); if(winW <= 750){ $("#foot-desc").css("height","auto"); $("#foot-desc").css("padding-top",0); $("#logoImg").css("padding-top",0); if(logoH >= txtH){ var sa = (logoH-txtH); $("#foot-desc").css("height",logoH); $("#foot-desc").css("padding-top",sa); }else{ var sa = (txtH-logoH)/2; $("#logoImg").css("padding-top",sa); } }else{ $("#foot-desc").css("height","auto"); $("#foot-desc").css("padding-top","12px"); $("#logoImg").css("padding-top",0); } } });