/* * Name: KEPCO * Part: JavaScript for ui & plug-in * Author : pk.choi */ (function($){ // jQuery.noConfict(); $(document).ready(function() { /* * Part: 아트센터 메인 * Function: * */ //아트센터 갤러리 슬라이드 var gallery = $('.gallery').slideVisualBanner({ interval:4000 ,speed: 700 ,navigation:{ btnstartpos:35 ,dist:38 } ,play:{ auto:false //기본값:초기에는 롤링멈춰있음 ,swap:false //기본값:false 플레이버튼과 정지버튼이 동시에 보여짐 //true 일때 토글형태로 번갈아 보여짐 } ,copy:{ //이미지카피 확장자 ext:'.png' //이미지카피 경로 ,path:'/kepco/indi/art/img/main/' //파일이름 ,name:'txt_gallery' } }); //전기박물관 슬라이드 $('.slides').slidesjs({ width:948, height:581, pagination:{active:false, effect:'slide'}, effect:{slide:{speed:800}} }); //공지사항/뉴스 $('.notice_wrap').news_ticker({ term: 4000 ,speed: 500 ,moveH: 50 ,easing: 'easeInOutSine' }); $('.press_wrap').news_ticker({ term: 4000 ,speed: 500 ,moveH: 50 ,easing: 'easeInOutSine' }); //우측 탭메뉴 클릭 var current_visualclass = 'art'; $('.main_contents h2.art a, .main_contents h2.gal a, .main_contents h2.mue a').on('click',function (event) { activeMainContents($(this).parent().attr('class')); return false; }); //스팟컨텐츠영역 활성화 var $bg_swap = $('.intro_wrap .bg_swap'); $('ul.spot_content li.spot01 a, ul.spot_content li.spot02 a, ul.spot_content li.spot03 a').on('mouseenter focusin',function (event) { var index = $(this).parent().index(); if(index != 0){ $(this).addClass('on'); $(this).find('span.bg').stop(true,true).fadeIn(600); } $bg_swap.stop(true,true).fadeIn(600); $bg_swap.addClass('bg0'+(index + 1)); }).on('mouseleave focusout',function (event) { var index = $(this).parent().index(); if(index != 0){ $(this).removeClass('on'); $(this).find('span.bg').stop(true,true).fadeOut(600); } $bg_swap.stop(true,true).fadeOut(600); $bg_swap.removeClass('bg0'+(index + 1)); }); //스팟컨텐츠영역 갤러리 클릭 $('ul.spot_content li.spot02 a').on('click',function (event) { event.preventDefault ? event.preventDefault() : event.returnValue = false; activeMainContents('gal'); }); //스팟컨텐츠영역 전기박물관 클릭 $('ul.spot_content li.spot03 a').on('click',function (event) { event.preventDefault ? event.preventDefault() : event.returnValue = false; activeMainContents('mue'); }); //전기박물관 컨텐츠영역 클릭 $('.museum ul.museum_list li a').on('click',function (event) { event.preventDefault ? event.preventDefault() : event.returnValue = false; if ($('.modal_overlay').length > 0) { // .modal_overlay exists //alert('modal_overlay exists already'); $('.modal_overlay').css({"min-width":1410}).show(); $('.electric_museum').addClass('on').appendTo('body'); $(".close_box a").focus(); return; } 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":1410, "opacity":"0.7" }); $('.electric_museum').addClass('on').appendTo('body'); } return false; }).on('mouseenter focusin',function (event) { $(this).parent().addClass('on'); $(this).parent().find('>img').css({'opacity':0}) .stop(true, true) .animate({'opacity':1}, 300, null); if($(this).parent().index() == 0 || $(this).parent().index() == 3){ if(detectBrowser().browser == 'Microsoft Internet Explorer'){ if(detectBrowser().b_version == '8'){ $(this).parent().find('>img').css({'margin-top':-173}) } } } }).on('mouseleave focusout',function (event) { $(this).parent().removeClass('on'); $(this).parent().find('>img') .stop(true, true) .animate({'opacity':0}, 300, null); }); //전기박물관 모달 레이어 닫기 $('.electric_museum dd.close_box a').on('click',function (event) { $('.modal_overlay').hide(); $('.electric_museum').removeClass('on').appendTo('.main_contents'); return false; }); $(this).on('focusin', '.electric_museum dd.close_box a', function () { $(this).keydown(function(e){ if(e.keyCode==9){ var cnt = $(".slides").find("a").length; if ( cnt== 1){ $(this).focus(); return false; } $(".slides").find("a:first").focus(); return false; } else if(e.keyCode==13){ $('.modal_overlay').hide(); $('.electric_museum').removeClass('on').appendTo('.main_contents'); if($focusTarget) $focusTarget.focus(); 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()); } } }); //우측탭메뉴 클릭시, 메인컨텐츠 영역 클릭시 해당컨텐츠 활성화 function activeMainContents(myclass){ if(myclass != current_visualclass){ $('.overlay').stop(true,true).fadeIn(600, null,function(){ $('.intro_wrap, .gallery, .museum').removeClass('on'); activeMainTab($('h2.'+myclass)); current_visualclass = myclass; $('.overlay').stop(true,true).fadeOut(600); switch (myclass){ case 'art': $('.intro_wrap').addClass('on'); gallery.stopLoopPlay(); setMinWidth(980); break; case 'gal': $('.gallery').addClass('on'); gallery.startLoopPlay(); gallery.setPlayStopBtn('play'); setMinWidth(980); break; case 'mue': $('.museum').addClass('on'); gallery.stopLoopPlay(); setMinWidth(1410); break; default: } }); } } //우측탭메뉴 클릭시, 메인컨텐츠 영역 클릭시 탭 활성화 function activeMainTab($tab){ var src_def = $('h2.'+current_visualclass).find('img').attr('src').replace('_on.gif', ".gif"); $('h2.'+current_visualclass).find('img').attr('src', src_def); var src_hover = $tab.find('img').attr('src').replace('.gif', "_on.gif"); $tab.find('img').attr('src', src_hover); } //min-width 재설정 function setMinWidth(valueH){ $('#ticker').css({'min-width':valueH}); $('#header').css({'min-width':valueH}); $('#footer').css({'min-width':valueH}); $('.main_contents').css({'min-width':valueH}); } });//end : document ready })(jQuery);