/* --------------------------------------------------------------------------------------- * Name : common.js * Desc : npsWebzine / common Javascript * Created : 2013/6/11 Jung seolbin --------------------------------------------------------------------------------------- */ jQuery(document).ready(function() { // GNB 마우스 오버시 색변환 $("#gnb li").bind('mouseenter 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").bind('mouseleave 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").bind('mouseenter 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").bind('mouseleave 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").mouseenter(function(){gnbShow1();}).focusin(function() {gnbShow1();}); $(".depth2 > a").mouseenter(function(){gnbShow2();}).focusin(function() {gnbShow2();}); $(".depth3 > a").mouseenter(function(){gnbShow3();}).focusin(function() {gnbShow3();}); $(".depth4 > a").mouseenter(function(){gnbShow4();}).focusin(function() {gnbShow4();}); // GNB 닫기 $("#wrapper h1").mouseenter(function(){gnbHide();}).focusin(function() {gnbHide();}); $("#under").mouseenter(function(){gnbHide();}).focusin(function() {gnbHide();}); $("#container").mouseenter(function(){gnbHide();}).focusin(function() {gnbHide();}); $("#footer").mouseenter(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"}); } });