$(document).ready(function(){ $('.depth1menu>li.sel').each(function() { $(this).addClass("on"); }); $('.depth2menu>li.sel').each(function() { $(this).addClass("on"); }); //GNB 메뉴 롤오버 $(".depth1menu>li").mouseover(function(){ $("#gnb_depth02").slideDown(350); $("#bgTop").slideDown(350); $(".depth1menu>li").removeClass("on"); $(this).addClass("on"); }); //GNB 서브 메뉴 롤오버 $('.depth2menu').delegate('li', 'mouseover focus', function() { $(".depth1menu>li").removeClass("on"); var nowID = $(this).parent().parent().attr("class"); $('.depth1menu>li.'+nowID).each(function() { $(this).addClass("on"); }); $('.depth2menu>li').removeClass("on"); $(this).addClass("on"); }).delegate('li','mouseleave',function(){ $('.depth2menu>li').removeClass("on"); $('.depth2menu>li.sel').each(function() { $(this).addClass("on"); }); $(".depth1menu>li").removeClass("on"); $('.depth1menu>li.sel').each(function() { $(this).addClass("on"); }); }); //GNB 메뉴 아웃 $('#containerwrap').mouseover(function() { $(".depth1menu>li").removeClass("on"); $('.depth1menu>li.sel').each(function() { $(this).addClass("on"); }); $("#bgTop").slideUp("fast"); $("#gnb_depth02").slideUp("fast"); $('.depth2menu>li').removeClass("on"); $('.depth2menu>li.sel').each(function() { $(this).addClass("on"); }); }); //GNB 메뉴 아웃 $('#bgTop').mouseout(function() { $(".depth1menu>li").removeClass("on"); $('.depth1menu>li.sel').each(function() { $(this).addClass("on"); }); $("#bgTop").slideUp("fast"); $("#gnb_depth02").slideUp("fast"); $('.depth2menu>li').removeClass("on"); $('.depth2menu>li.sel').each(function() { $(this).addClass("on"); }); }); //모바일 메뉴 $('#mGnb>.depth01>li>img').click(function() { if ($(this).parent("li").hasClass("hover") != true) { $("#mGnb>.depth01>li").removeClass("on"); $("#mGnb>.depth01>li").removeClass("hover"); $(this).parent("li").addClass("on"); $(this).parent("li").addClass("hover"); $('#mGnb>.depth01>li>img').each(function() { var Searchsrc = $(this).attr("src"); $(this).attr('src', Searchsrc.replace('_up', '_down')); }); var ImgSrc = $(this).attr("src"); $(this).attr("src", ImgSrc.replace('_down', '_up')); } else { $('#mGnb>.depth01>li.hover>img').each(function() { var Searchsrc = $(this).attr("src"); $(this).attr('src', Searchsrc.replace('_up', '_down')); }); $("#mGnb>.depth01>li").removeClass("on"); $("#mGnb>.depth01>li").removeClass("hover"); } }); //1080px 이하일경우 모바일 메뉴 자동으로 닫기 $(window).resize(function(){ var winW = $(window).width(); if (winW > 1080) { $("#mGnb").hide(); } }) }); // 레이어 팝업 function onLayerPop(layerId) { //alert(layerId); if (layerId == 'offLayer'){ $(".pop_layer").hide(); } else { var h = $("#"+layerId).height(); // $(".pop_layer_back").hide(); if(document.body.scrollHeight <= document.body.Height){ var allHeight = document.body.Height; } else { var allHeight = document.body.scrollHeight; } $(".pop_layer").hide(); $(".pop_layer_back").css("height",allHeight).show(); //스크롤때문에 전체 height값을 구해 배경에 직접height값 적용 if (layerId == 'item_detail') { var position = $(window).scrollTop(); $("#"+layerId).show(); $("#"+layerId+">.popContent").css("top", position+250).show(); } else { $("#"+layerId).show(); $("#"+layerId+">.popContent").show(); } } } // 레이어 팝업(메뉴 상세보기) function onLayerPopMenu(layerId, uid) { //alert(layerId); if (layerId == 'offLayer'){ $(".pop_layer").hide(); } else { // 해당 상품 상세정보 가져오기 var d = "sUID=" + uid; $.ajax({ url : "getMenuDetailInfo.php", data : d, dataType : "html", type : "post", success : function(objData) { $('.popContent').html(objData); var h = $("#"+layerId).height(); // $(".pop_layer_back").hide(); if(document.body.scrollHeight <= document.body.Height){ var allHeight = document.body.Height; } else { var allHeight = document.body.scrollHeight; } $(".pop_layer").hide(); $(".pop_layer_back").css("height",allHeight).show(); //스크롤때문에 전체 height값을 구해 배경에 직접height값 적용 if (layerId == 'item_detail') { var position = $(window).scrollTop(); $("#"+layerId).show(); $("#"+layerId+">.popContent").css("top", position+250).show(); } else { $("#"+layerId).show(); $("#"+layerId+">.popContent").show(); } } }); } } // 레이어 팝업(갤러리탐 상세보기) function onLayerPopGallery(layerId, uid) { //alert(layerId); if (layerId == 'offLayer'){ $(".pop_layer").hide(); } else { // 해당 갤러리 상세정보 가져오기 var d = "sUID=" + uid; $.ajax({ url : "getGalleryDetailInfo.php", data : d, dataType : "html", type : "post", success : function(objData) { $('.popContent').html(objData); var h = $("#"+layerId).height(); // $(".pop_layer_back").hide(); if(document.body.scrollHeight <= document.body.Height){ var allHeight = document.body.Height; } else { var allHeight = document.body.scrollHeight; } $(".pop_layer").hide(); $(".pop_layer_back").css("height",allHeight).show(); //스크롤때문에 전체 height값을 구해 배경에 직접height값 적용 if (layerId == 'item_detail') { var position = $(window).scrollTop(); $("#"+layerId).show(); $("#"+layerId+">.popContent").css("top", position+250).show(); } else { $("#"+layerId).show(); $("#"+layerId+">.popContent").show(); } jQuery('.page_btn>a>img').mouseover(function() { var ImgSrc = jQuery(this).attr("src"); jQuery(this).attr("src", ImgSrc.replace('_off', '_on')); }).mouseleave(function() { var ImgSrc = jQuery(this).attr("src"); jQuery(this).attr("src", ImgSrc.replace('_on', '_off')); }); } }); } } // 상세정보 변경 function changeMenuSize(uid, sType, sSize) { // 해당 상품 상세정보 가져오기 var d = "sUID=" + uid + "&sType=" + sType + "&sSIZE=" + sSize; $.ajax({ url : "getMenuDetailInfo.php", data : d, dataType : "html", type : "post", success : function(objData) { $('.popContent').html(objData); var h = $("#"+layerId).height(); // $(".pop_layer_back").hide(); if(document.body.scrollHeight <= document.body.Height){ var allHeight = document.body.Height; } else { var allHeight = document.body.scrollHeight; } $(".pop_layer").hide(); $(".pop_layer_back").css("height",allHeight).show(); //스크롤때문에 전체 height값을 구해 배경에 직접height값 적용 if (layerId == 'item_detail') { var position = $(window).scrollTop(); $("#"+layerId).show(); $("#"+layerId+">.popContent").css("top", position+250).show(); } else { $("#"+layerId).show(); $("#"+layerId+">.popContent").show(); } } }); } // 매장찾기 상세보기 open_ViewImg=function(uFileName, divId){ jQuery("."+divId+">img").attr("src", uFileName); } // 천단위 콤마찍기 function addComma(str) { str = str + ""; return str.split(/(?=(?:\d{3})+(?:\.|$))/g).join(','); }