/* --------------------------------------------------------------------------------------- * Name : common.js * Desc : npsWebzine / common Javascript * Created : 2013/6/11 Jung seolbin --------------------------------------------------------------------------------------- */ jQuery(document).ready(function() { // GNB 마우스 오버시 색변환 $("#gnb li").mouseover(function(){ var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_off.png","_on.png"); temp.attr("src",currImg); }).focusin(function(){ var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_off.png","_on.png"); if(oriImg.indexOf("_off.png") != -1){ temp.attr("src",currImg); } }); $("#gnb li").mouseout(function() { var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_on.png","_off.png"); temp.attr("src",currImg); }).focusout(function(){ var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_on.png","_off.png"); temp.attr("src",currImg); }); // depth 마우스 오버시 색변환 $("#gnb li ul li").mouseover(function(){ var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_off.gif","_on.gif"); temp.attr("src",currImg); }).focusin(function(){ var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_off.gif","_on.gif"); if(oriImg.indexOf("_off.gif") != -1){ temp.attr("src",currImg); } }); $("#gnb li ul li ").mouseout(function() { var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_on.gif","_off.gif"); temp.attr("src",currImg); }).focusout(function(){ var temp = $(this).find(">a").children(); var oriImg = temp.attr("src"); var currImg = oriImg.replace("_on.gif","_off.gif"); temp.attr("src",currImg); }); // GNB 열기 $(".depth1 > a").mouseover(function(){gnbShow1();}).focusin(function() {gnbShow1();}); $(".depth2 > a").mouseover(function(){gnbShow2();}).focusin(function() {gnbShow2();}); $(".depth3 > a").mouseover(function(){gnbShow3();}).focusin(function() {gnbShow3();}); $(".depth4 > a").mouseover(function(){gnbShow4();}).focusin(function() {gnbShow4();}); // GNB 닫기 $("#wrapper h1").mouseover(function(){gnbHide();}).focusin(function() {gnbHide();}); $("#under").mouseover(function(){gnbHide();}).focusin(function() {gnbHide();}); $("#container").mouseover(function(){gnbHide();}).focusin(function() {gnbHide();}); $("#footer").mouseover(function(){gnbHide();}).focusin(function() {gnbHide();}); function gnbShow1(){ gnbHide(); $(".depth1 ul").show(); $(".depth2").css({'z-index':"1"}); $(".depth3").css({'z-index':"1"}); $(".depth4").css({'z-index':"1"}); $(".depth1").css({'z-index':"99"}); } function gnbShow2(){ gnbHide(); $(".depth2 ul").show(); $(".depth1").css({'z-index':"1"}); $(".depth3").css({'z-index':"1"}); $(".depth4").css({'z-index':"1"}); $(".depth2").css({'z-index':"99"}); } function gnbShow3(){ gnbHide(); $(".depth3 ul").show(); $(".depth1").css({'z-index':"1"}); $(".depth2").css({'z-index':"1"}); $(".depth4").css({'z-index':"1"}); $(".depth3").css({'z-index':"99"}); } function gnbShow4(){ gnbHide(); $(".depth4 ul").show(); $(".depth1").css({'z-index':"1"}); $(".depth2").css({'z-index':"1"}); $(".depth3").css({'z-index':"1"}); $(".depth4").css({'z-index':"99"}); } function gnbHide(){ $("#gnb li ul").hide(); $("#gnb li").css({'z-index':"99"}); } });