if( window.console == undefined ){ console = { log : function(){} }; } $(document).ready(function(){ gnbmenu = new GnbMenu(); cssControl(); frelbox(); zoomfunc(); totalMenu(); }); function GnbMenu(){ this.$currenItem; this.$gnb_zone = $(".gnb_zone"); this.$gnb_item = $("li.gli"); this._rockActive; this.$lnbone; this.gnbtwo_row = $(".gnbtwo_row"); // this._onGnb(this.$gnb_item.eq(0)); this._eventGnb(); this._focusGnb(); this.$gm; this.$twod; this.$twod_m; this.$gnb_zone.append("
"); }; GnbMenu.prototype._eventGnb = function(){ var objthis = this; this.$gnb_item.each(function(){ objthis.$gnb_item.on("mouseenter",function(){ if(objthis.$currenItem){ objthis._offGnb(objthis.$currenItem); }; objthis._onGnb($(this)); }); objthis.$gnb_zone.on("mouseleave",function(){ if(objthis.$currenItem){ objthis._offGnb(objthis.$currenItem); }; if(objthis.$rockItem){ objthis._onGnb(objthis.$rockItem); }; }); }); // this.$twod_m = $(".tw"); // this.$twod_m.each(function(){ // $(this).prepend(""); // }); }; GnbMenu.prototype._focusGnb = function(onedepth,twodepth){ var objthis = this; this.$gnb_item.each(function(){ objthis.$gnb_item.on("focusin",function(){ objthis.$gm = $(this).find(".gm"); objthis.$twod = $(this).find(".twod"); objthis.gnbtwo_row.show(); objthis.$gm.removeClass("gmon").addClass("gmon"); $("a.gm").not(objthis.$gm).removeClass("gmon"); objthis.$twod.show(); $(".twod").not(objthis.$twod).hide(); }); $(".topsearch_w").on("focusin",function(){ $("a.gm").removeClass("gmon"); }); }); $("ul.lnb a").each(function(){ $(this).on("focusin",function(){ $(this).addClass("on"); $("ul.lnb a").not($(this)).removeClass("on"); }); }); $(".tw").each(function(){ $(this).on("focusin",function(){ $(this).addClass("ton"); $(".tw").not($(this)).removeClass("ton"); }); }); $(".sub_contents").on("focusin",function(){ $(".twod:last-child").hide(); if(objthis.$rockItem){ objthis._onGnb(objthis.$rockItem); }; }); $(".subcont_z").on("focusin",function(){ var $fewfw = $("ul.lnb").find("li:last-child"); $fewfw.find("a").removeClass("on"); }); }; GnbMenu.prototype._offGnb = function($item){ if($item == 'undefined'){$item='';}; this.$gm = $item.find(".gm"); this.$twod = $item.find(".twod"); if(this.elserock){this.gnbtwo_row.hide();} this.$gm.removeClass("gmon"); this.gnbtwo_row.hide(); this.$twod.stop().hide(); }; GnbMenu.prototype.menurock = function(onedepth,twodepth,threedepth){ var onedepth = onedepth , twodepth = twodepth; onedepth = parseInt(onedepth); twodepth = parseInt(twodepth); this.$lnblia = $("lm"+onedepth), this.$sct = $("h2.sct"); this.elserock = false; //this.gnbtwo_row.css("display","block !important"); this.$sct.addClass("sct"+onedepth); this._rockGnb($("#gli"+onedepth)); $(".sub_contents").find(".pixin").addClass("sv"+onedepth); this.$lnbone = $("ul.lnb"); this.$lnboneli = this.$lnbone.find("li"); this.$lnboneli.addClass("lmone"+onedepth); this.$lnboneli.find("a#lmb"+twodepth).addClass("lmrock"); $("#tw"+onedepth+"_"+twodepth).addClass("twodrock"); $("#lmb"+twodepth+threedepth).addClass("lmrock"); if(twodepth == "4" && onedepth == "3" || twodepth == "5" && onedepth == "3" || twodepth == "6" && onedepth == "3" ){ this.$lnboneli.find("a#lmb"+twodepth).removeClass("lmrock").css("color","#bf0e0e"); $("#lmb"+twodepth+"sel").css("padding",0); $("#lmb"+twodepth+"sel").find("ul.lth").show(); $("ul.lth").not($("#lmb"+twodepth+"sel").find("ul.lth")).hide(); }else{ this.$lnboneli.find("a#lmb"+twodepth).addClass("lmrock"); } if(onedepth == "5"){ this._offGnb($("#gli")); this.elserock = true; this.$rockItem = ""; //console.log(onedepth); }; }; GnbMenu.prototype._onGnb = function($item){ this.$gm = $item.find(".gm"); this.$twod = $item.find(".twod"); this.$gm.removeClass("gmon").addClass("gmon"); this.gnbtwo_row.show(); this.$twod.stop().show(); this.$currenItem = $item; }; GnbMenu.prototype._rockGnb = function($item){ this._onGnb($item); this.$rockItem = $item; }; function cssControl(){ var $clearParents = $(".pixin, .fmenu_zone,.adp"); $.each($clearParents,function(){ $(this).append("
"); }); var $bruf = $(".bruf:eq(0)"); $bruf.css("padding-top",0); $bruf.find(".lk_t").css("margin-top","0"); var $brulast = $(".bruf:eq(1)"); $brulast.css({"padding-bottom":0,"border":0}); $brulast.find(".lk_t").css("margin-top","0"); $(window).resize(function(){ browserFunc(); }); browserFunc(); function browserFunc(){ var $windowWid = $(window).width(); var $test = $('.sub_quick'); //console.log($windowWid); if($windowWid > 1200){ $("#page_wrap").css("min-width",1040); //console.log($(window).scrollTop()); }else if($windowWid <= 1280){ $("#page_wrap").css("min-width",1280); }; } }; function frelbox(){ var $fsel_w = $(".fsel_w"); var $fsevfir = $(".fsel_v").find("a:last-child"); var $fsevlink = $(".fsel_v").find("a"); /*$fsel_w.each(function(){ $(this).find(".fsel_v").css("width",$(this).width()+22); });*/ $fsel_w.find(".ftit").on("focusin",function(){ var $parent = $(this).parents(".fsel_w"); $parent.find(".fsel_v").slideDown(); }); $fsel_w.find(".btn").on("click",function(){ var $parent = $(this).parents(".fsel_w"); $parent.find(".fsel_v").slideToggle(); }); $fsevlink.on("click",function(){ var $fselparent = $(this).parents(".fsel_w"); $fselparent.find(".ftit").text($(this).text()); }); $(".skiplist a").on("focus",function(){ $fsel_w.find(".fsel_v").slideUp(); }); }; function zoomfunc(){ var canUse = false; var zoomFirst = 100; var zoomFirst_ff = 1; $("#zoomPlus").on("click",function(){ if (zoomFirst!=300 || zoomFirst_ff != 3.0){ zoomFirst += 10; zoomFirst_ff += 0.1; $("body,html").css("zoom",zoomFirst+"%"); var browserName = "Unknown"; var browserVer = ""; var browserVerMain = ""; if (/Firefox/.test(navigator.userAgent)) { canUse = true; browserName = "Firefox"; browserVer = /Firefox\/([\d\.]+)/.exec(navigator.userAgent)[1]; browserVerMain = /(\d+)\./.exec(browserVer)[1]; } if (browserName == "Firefox") { $("body").css("-moz-transform","scale("+zoomFirst_ff+")"); } } }); $("#zoomMinus").on("click",function(){ if (zoomFirst!=100 || zoomFirst_ff != 1.0){ zoomFirst -= 10; zoomFirst_ff -= 0.1; $("body,html").css("zoom",zoomFirst+"%"); var browserName = "Unknown"; var browserVer = ""; var browserVerMain = ""; if (/Firefox/.test(navigator.userAgent)) { canUse = true; browserName = "Firefox"; browserVer = /Firefox\/([\d\.]+)/.exec(navigator.userAgent)[1]; browserVerMain = /(\d+)\./.exec(browserVer)[1]; } if (browserName == "Firefox") { $("body").css("-moz-transform","scale("+zoomFirst_ff+")"); } } }); } function totalMenu(){ $("#totalm").on("click",function(){ $("#total_menu").show(); }); $(".total_menu_in").find(".close").on("click",function(){ $("#total_menu").hide(); }); }