/* * Name: KEPCO * Part: JavaScript for ui & plug-in * Author : pk.choi */ (function($){ // jQuery.noConfict(); $(document).ready(function() { /*footer family site, sponsor site */ footerFamily(); /* * Part: 약관동의 외부페이지로드 */ $('#requestAgreeBox').loadExternalPage({ path:'/kepco/front/html/CY/F/A/CYFAPP001.html #wrap' }); /* * Part: 모달레이어팝업 */ $(this).on('click', '.modal_trigger', function (event) { //prevent default action (hyperlink) event.preventDefault ? event.preventDefault() : event.returnValue = false; // event.preventDefault(); //Get clicked link href var href = $(this).attr("href") + " #wrapPop"; $(".close_box a").focus(); if ($('.modal_overlay').length > 0) { // .modal_overlay exists // alert('modal_overlay exists already'); $('.modal_overlay').show(); } else { //.modal_overlay does not exist - create and insert (runs 1st time only) //create HTML markup for lightbox window var lightbox = '' //insert lightbox HTML into page $('body').append(lightbox); $(".modal_overlay").css({ "zIndex":9999, "width":$(window).width(), "height":$(document).height(), "min-width":980, "opacity":"0.7" }); } if ($('.modal_content').children().length > 0) { // .modal_content's children exists // alert('modal_content children exists already'); $('.modal_content').show(); $('.modal_content').find('input').eq(0).focus().select(); } else{ $('.modal_content').show(); $('.modal_content').load(href,function() { // var objCont = $(this).find('#wrapPop'); var objCont = $(this); var objWidth = objCont.find('#wrapPop').outerWidth(); var objHeight = objCont.find('#wrapPop').outerHeight(); var maxH = 520; //popContainer의 내용이 보여지는 영역 기준높이 var topH = 56; //상단 타이틀 영역 높이 objCont.css({ "position":"fixed", "zIndex":10000, "width":objWidth, "height":objHeight, "marginLeft":-objWidth/2, "marginTop":-objHeight/2}); /*if(navigator.appVersion.indexOf("MSIE 8") != -1){ objHeight += 4; }else if(navigator.appVersion.indexOf("MSIE 7") != -1){ objHeight -= 1; }*/ //objHeight 가 기준높이보다 클때 popContainer에 scroll,높이값 설정 후 //modal_content의 marginTop 재설정 if(objHeight >= maxH + topH) { $('.modal_content .popContainer').css({ "overflow-x":"hidden", "overflow-y":"scroll", "height":maxH }); $('.modal_content').css({ "marginTop":-(maxH + topH)/2 }); } objCont.find('input').eq(0).focus().select(); }); } }); //레이어팝업닫기 $(this).on('click', 'dl.popLayout.lpop dd.close_box a', function () { $('.modal_overlay').hide(); $('.modal_content').empty().hide(); return false; }); //브라우저 리사이즈시 모달레이어 너비,높이조정 $(window).resize(function(){ if ($('.modal_overlay').length > 0) { if($('.modal_overlay').is(':visible')){ $('.modal_overlay') .css("width", $(window).width()) .css("height", $(document).height()); } } }); /* * Part: 윈도우팝업닫기 */ $('dl.popLayout dd.close_box a, dl.popLayout a.close_wpop').bind('click', function () { popClose(); return false; }); /* * Part: FAQ 리스트 토글 */ $('.faq_list li>a').bind('click', function () { if($(this).parent().hasClass('on')){ $(this).parent().removeClass('on'); }else{ $('.faq_list li').removeClass('on'); $(this).parent().addClass('on'); } }); /* * Part: 선수상세 이미지 썸네일 클릭(사이드) */ $('.player_view .player_thumb_list li a').on('click', function () { var $img_tmb = $(this).find('img'); var $img_big = $('.player_view p.big img'); var src = $img_tmb.attr('src'); var alt = $img_tmb.attr('alt'); $img_big.attr({'src':src,'alt':alt}); return false; }); /* tab 메뉴 활성화 표시 2015.03.31 민승우 */ var tabLayer = $(".wrap_tab"); var tabOnTitle = tabLayer.find("li.on > a").text(); var tabOnTitle2 = tabLayer.find("li.sub_on > a").text(); tabLayer.find("li").each(function(){ var tabOffTitle = $(this).find("a").text(); $(this).find("a").attr("title",tabOffTitle); }); tabLayer.find("li.on").children("a").attr("title",""+ tabOnTitle +"(현재페이지)"); tabLayer.find("li.sub_on").children("a").attr("title",""+ tabOnTitle2 +"(현재페이지)"); /* table tab 메뉴 활성화 표시 2015.04.02 민승우 */ var tableTab = $(".tab_table"); var tableTabOnTitle = tableTab.find("td.on > a").text(); tableTab.find("td").each(function(){ var tableTabOffTitle = $(this).find("a").text(); $(this).find("a").attr("title",tableTabOffTitle); }); tableTab.find("td.on > a").attr("title",""+ tableTabOnTitle +"(선택됨)"); tableTab.find("table").removeAttr("summary");//레이아이웃용 테이블이기때문에 삭제함 2015.04.20 민승우 추가수정 tableTab.find("caption").remove();//레이아이웃용 테이블이기때문에 삭제함 2015.04.20 민승우 추가수정 });//end : document ready /* * Part: loadExternalPage plug-in */ $.fn.loadExternalPage = function(options){ var defaults = { path:'' }, settings = $.extend({}, defaults, options); this.each(function(){ // var $this = $(this); //Default Action $(this).load(settings.path); }); return this; } })(jQuery); $(document).ready(function() { //스킵메뉴 포커스 - 141119민승우 추가 if($("#container").children("div").is( "#lnb")){//lnb가 없을경우 스킵네비게이션에서 lnb >>dislpay:none처리 //alert("aa"); }else{ $(".skipMenu > a").each(function(){ if($(this).attr("href") == "#lnb"){ $(this).css("display","none"); } }); } $(".skipMenu > a").on("click",function(event){ var skipM = $(this).attr("href"); if($("#container").children().attr("id") == "lnb"){//컨테이너에 lnb가 있을경우 컨테이너 클릭시 컨텐츠로 이동 if(skipM == "#container"){ $("#content").find("a:first").focus(); }else{ $(skipM).find("a:first").focus(); } }else{ $(skipM).find("a:first").focus(); } return false; }); }); /*footer family site, sponsor site*/ var footerFamily = function(){ var footerSiteLink = $('.site_link'); var footerSiteLinkLi = $('.site_link>li'); var footerSelectLink = $('.site_link>li>ul'); footerSelectLink.hide(); footerSiteLinkLi.bind('mouseover focusin', function(e){ footerSelectLink.hide(); $(this).find('>ul').show(); footerSiteLinkLi.css({'background-position': '103px 8px'}); $(this).css({'background-position': '103px -42px'}); }); footerSiteLinkLi.bind('mouseleave', function(){ footerSelectLink.hide(); footerSiteLinkLi.css({'background-position': '103px 8px'}); }); // 2015-03-31 오대영 추가 $('.site_link>li>ul>li:last-child').bind('focusout', function(){ footerSelectLink.hide(); footerSiteLinkLi.css({'background-position': '103px 8px'}); }); } //----------------------------------------------- /***** WINDOW POPUP ALIGN CENTER *****/ //----------------------------------------------- function open_window(name, url, w, h, toolbar, menubar, statusbar, scrollbar, resizable, loc_box) { toolbar_str = toolbar ? 'yes' : 'no'; menubar_str = menubar ? 'yes' : 'no'; statusbar_str = statusbar ? 'yes' : 'no'; scrollbar_str = scrollbar ? 'yes' : 'no'; resizable_str = resizable ? 'yes' : 'no'; var left = 0; var top = 0; left = (screen.availWidth - w) / 2; top = (screen.availHeight - h) / 2; win = window.open(url, name, 'left='+left+',top='+top+',width='+w+',height='+h+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str); //win.focus(); } /* POPUP CLOSE */ function popClose(){ if(navigator.appVersion.indexOf("MSIE 6") != -1){ window.opener = window.location.href; self.close(); }else { parent.window.open('about:blank','_self').close(); } } //------------------------------------ /***** 레이어 변환 *****/ //------------------------------------ function ch_layer(hidden , show){ var hl = document.getElementById(hidden); var sl = document.getElementById(show); hl.style.display = "none"; sl.style.display = ""; }