PageSourceSearch

https://kpx.or.kr/main/js/main.js

js kpx.or.kr collected 2026-10-02 06:16:37 UTC 16,607 bytes, 589 lines download raw bytes

1/*-------------------------------------------------
2title       : 메인
3-------------------------------------------------*/
4
5$(function(){
6
7	//메인 fullpage
8	$('.main_wrap').fullpage({
9		navigation: false,								// 네비게이션 도트 사용
10		scrollingSpeed: 700,							// 스크롤 속도
11		responsiveWidth: 1200,							// 가로크기가 설정값 이상일때 자석 스크롤 동작
12		responsiveHeight: 800,							// 세로크기가 설정값 이상일때 자석 스크롤 동작
13        keyboardScrolling: true,						// 키보드 스크롤 사용
14		scrollHorizontally: true,						// 키보드 스크롤 사용
15		scrollOverflow: false,							// 섹션내에서 스크롤바 사용
16		verticalCentered: true,							// 섹션내에서 세로 중앙 정렬
17		css3: true,										// css3 사용
18		easingcss3: 'ease',								// css3 애니메이션
19		scrollingSpeed: 700,							// 스크롤 속도
20		scrollBar: false,								// 스크롤바 출력
21		onLeave: function(origin, destination, direction) {							// 전환 직전 실행되는 콜백함수
22			if(direction == 'down'){
23				$('#header').addClass('change');
24			}
25			else if(origin == 2 && direction == 'up'){
26				$('#header').removeClass('change');
27			}
28		}
29	});
30
31	$(window).on("load resize", function (e) {
32		$('body').each(function(){
33			if ( $(this).hasClass('fp-viewing-section-2nd') == true )
34			{
35				$('#header').addClass('change');
36			} else if ( $(this).hasClass('fp-viewing-section-3rd') == true )
37			{
38				$('#header').addClass('change');
39			} else if ( $(this).hasClass('fp-viewing-section-4th') == true )
40			{
41				$('#header').addClass('change');
42			} else if ( $(this).hasClass('fp-viewing-section-5th') == true )
43			{
44				$('#header').addClass('change');
45			} else if ( $(this).hasClass('fp-viewing-section-footer') == true )
46			{
47				$('#header').addClass('change');
48			} else {
49				$('#header').removeClass('change');
50			}
51		});
52	});
53
54	// scroll 버튼
55    $('.go_scroll').click( function(e) {
56		e.preventDefault();
57		$.fn.fullpage.moveSectionDown();
58	});
59
60	// TOP 버튼
61	$('#quick_nav .up').click( function(e) {
62		if($(window).width() > 1199){
63			$.fn.fullpage.moveTo('section-1st', 1);
64			$('#header').removeClass('change');
65		}else{
66			$("html, body").animate({scrollTop: 0}, 1100);
67		}
68		e.preventDefault();
69	});
70
71    //웹접근성
72	/* 테스트중 
73	$(document).on("keydown", function(e) {
74		if(e.keyCode == "9") { // tab키
75			//백탭
76			if(e.shiftKey) { //+ shift키
77				if($(".section02 a:first").is(":focus")) {
78				  $.fn.fullpage.moveTo(1); 
79				  $(".section01 button:last").attr("tabindex", 0).show().focus();
80				  // 이전 섹션의 포커스 가능한 마지막 요소의 tabindex 지정, 포커스한다. 
81				}
82				if($(".section03 a:first").is(":focus")) {
83				  $.fn.fullpage.moveTo(2);
84				  $(".section02 button:last").attr("tabindex", 0).show().focus();
85				}
86				if($(".section04 a:first").is(":focus")) {
87				  $.fn.fullpage.moveTo(3);
88				  $(".section03 button:last").attr("tabindex", 0).show().focus();
89				}
90				if($(".section05 a:first").is(":focus")) {
91				  $.fn.fullpage.moveTo(4);
92				  $(".section04 button:last").attr("tabindex", 0).show().focus();
93				}
94				if($(".footbanner a:first").is(":focus")) {
95				  $.fn.fullpage.moveTo(5);
96				  $(".section05 button:last").attr("tabindex", 0).show().focus();
97				}
98			} else {
99				//탭
100				if($(".section01 button:last").is(":focus")) {
101				  $.fn.fullpage.moveTo(2);
102				}
103				if($(".section02 button:last").is(":focus")) {
104				  $.fn.fullpage.moveTo(3);
105				}
106				if($(".section03 button:last").is(":focus")) {
107				  $.fn.fullpage.moveTo(4);
108				}
109				if($(".section04 button:last").is(":focus")) {
110				  $.fn.fullpage.moveTo(5);
111				}
112				if($(".section05 button:last").is(":focus")) {
113				  $.fn.fullpage.moveTo(6);
114				}
115			}
116		}
117	});
118	*/
119
120	//visual_slide
121	var visual_total_count = $('.visual_slide > li').length;
122	var visual_slide = $('.visual_slide').bxSlider({
123		mode:'fade',
124		touchEnabled: false,
125		auto: true,
126		autoControls: false,
127		infiniteLoop: true,
128		autoDelay: 100,
129		pause: 3000,
130		//randomStart: true, //슬라이드 출력 랜덤
131		autoHover: true,
132		pager: false,
133		onSliderLoad: function(){
134			$('.visual_count > .total').text(visual_total_count);
135		},
136		onSlideAfter: function($slideElement, oldIndex, newIndex) {
137			$('.visual_count > .current').text(newIndex+1);
138		},
139		onSlideBefore: function($slideElement, oldIndex, newIndex) {
140			if(newIndex == 0){
141				$(".btn_main_play").css("display", "block");
142			}else{
143				$(".btn_main_play").css("display", "none");
144			}
145		}
146	});
147	
148	$('.visual_btn > a').on('click', function(){
149		if($(this).hasClass('prev') == true){
150			visual_slide.goToPrevSlide();
151			visual_slide.stopAuto();
152		}else if($(this).hasClass('next') == true){
153			visual_slide.goToNextSlide();
154			visual_slide.stopAuto();
155		}
156	});
157	$('.btn_visual_start').on('click',function(){
158		$(this).css('display','none');
159		$('.btn_visual_stop').css('display','block');
160		$('.btn_visual_stop').focus();
161		visual_slide.startAuto();
162		return false;
163	});
164	$('.btn_visual_stop').on('click',function(){
165		$(this).css('display','none');
166		$('.btn_visual_start').css('display','block');
167		$('.btn_visual_start').focus();
168		visual_slide.stopAuto();
169		return false;
170	});
171	$('.visual_control > a').bind('mouseenter',function(e){
172		e.preventDefault();
173		visual_slide.startAuto();    
174	});
175	$('.visual_control > a').bind('mouseleave',function(e){
176		e.preventDefault();
177		if($('.visual_control .btn_visual_start').is(':visible') === true) { // 이전, 다음 버튼 오버시 슬라이드가 정지상태라면
178			visual_slide.stopAuto();
179		} else {
180			visual_slide.startAuto();
181		}    
182	});
183
184	var visual_active_key;
185	$(".results_data li:last-child a").on("keydown",function(e){
186		if(e.keyCode == 9 && !e.shiftKey ){
187			visual_slide.reloadSlider({
188				auto: false,
189				infiniteLoop: false,
190				speed: 0,
191				controls: false,
192				autoControls: false,
193				autoHover: false,
194				pager: false,
195			});
196			setTimeout(function(){
197				$(".visual_slide > li:first-child > a").focus();
198			},200);
199			$(".visual_btn > a").remove();
200			$(".visual_btn").prepend("<a href='#none' class='btn_visual_prev'>이전</a>");
201			$(".visual_btn").append("<a href='#none' class='btn_visual_next'>다음</a>");
202			$(".visual_control").hide();
203			$(".visual_slide > li > a").on("focusin", function(e){
204				e.preventDefault();
205				var idx = $(this).parent().index();
206				$(".visual_count > .current").text(idx + 1);
207				visual_active_key = idx;
208			});
209			$(".btn_visual_prev").bind("click",function(e){
210				e.preventDefault();
211				if(visual_active_key==0){
212				}else{
213				  var slideNum = visual_active_key - 1;
214				  $(".visual_slide > li > a").removeClass("on");
215				  $(".visual_slide > li:eq("+slideNum+") > a").trigger("focus").addClass("on");
216				  $(this).focus();
217				}
218			});
219			$(".btn_visual_next").bind("click",function(e){
220				e.preventDefault();
221				lastSlide = $(".visual_slide > li").length;
222				if(visual_active_key==lastSlide){
223				}else{
224					var slideNum = visual_active_key + 1;
225					$(".visual_slide > li > a").removeClass("on");
226					$(".visual_slide > li:eq("+slideNum+") > a").trigger("focus").addClass("on");
227					$(this).focus();
228				}
229			});
230			$(".visual_slide a:first-child").on("keyup",function(e){
231				if(e.keyCode == 9 && !e.shiftKey ){
232					$(".visual_slide > li > a").removeClass("on");
233				}
234			});
235		}
236	});
237
238
239	//오늘의 전력정보
240	 $('.power_for').slick({
241		centerMode: true,
242		centerPadding: '0',
243		slidesToShow: 3,
244		slidesToScroll: 1,
245		arrows: true,
246		asNavFor: '.power_nav',
247		responsive: [
248		{
249			breakpoint: 1680,
250			settings: {
251				slidesToShow: 1,
252				centerPadding: '25%',
253				slidesToScroll:1
254			}
255		},
256		{
257			breakpoint: 1360,  
258			settings: {
259				slidesToShow: 1,
260				centerPadding: '10%',
261				slidesToScroll:1
262			}
263		},
264		{
265			breakpoint: 769,  
266			settings: {
267				slidesToShow: 1,
268				centerPadding: '0',
269				slidesToScroll:1,
270				adaptiveHeight: true
271			}
272		},
273		{
274			breakpoint: 481,  
275			settings: {
276				slidesToShow: 1,
277				centerPadding: '0',
278				slidesToScroll:1,
279				adaptiveHeight: true
280			}
281		}]
282	});
283	$('.power_nav').slick({
284		slidesToShow: 4,
285		slidesToScroll: 1,
286		asNavFor: '.power_for',
287		dots: false,
288		centerMode: false,
289		focusOnSelect: true,
290		variableWidth: true
291	});
292
293	 $('.power_for').slick('goTo', 1);
294
295	//shortcut_slider
296	//var shortcut_slider = $('.shortcut .list');  	
297	//var slickOptions = { 		
298	//	infinite: true, 		
299	//	slidesToShow: 1, 		
300	//	slidesToScroll: 1, 		
301	//	dots:false, 		
302	//	arrows:true 	
303	//};  	
304
305
306	//$(window).on('load resize', function() { 		
307	//	if($(window).width() > 768) { 			
308	//		shortcut_slider.slick('unslick'); 		
309	//	}else{ 			
310	//		shortcut_slider.not('.slick-initialized').slick(slickOptions); 		
311	//	} 
312	//});
313
314
315	//popup_slide
316	var popup_slide = $('.popup_slide').bxSlider({
317		touchEnabled: true,
318		auto: true,
319		autoControls: false,
320		infiniteLoop: true,
321		pause: 5000,
322		autoHover: true,
323		pager: true,
324		pagerType: 'short',
325	});
326	$('.popup_btn > a').on('click', function(){
327		if($(this).hasClass('prev') == true){
328			popup_slide.goToPrevSlide();
329			popup_slide.stopAuto();
330		}else if($(this).hasClass('next') == true){
331			popup_slide.goToNextSlide();
332			popup_slide.stopAuto();
333		}
334	});
335	$('.btn_popup_start').on('click',function(){
336		$(this).css('display','none');
337		$('.btn_popup_stop').css('display','block');
338		$('.btn_popup_stop').focus();
339		popup_slide.startAuto();
340		return false;
341	});
342	$('.btn_popup_stop').on('click',function(){
343		$(this).css('display','none');
344		$('.btn_popup_start').css('display','block');
345		$('.btn_popup_start').focus();
346		popup_slide.stopAuto();
347		return false;
348	});
349	$('.popup_control > a').bind('mouseenter',function(e){
350		e.preventDefault();
351		popup_slide.stopAuto();    
352	});
353	$('.popup_control > a').bind('mouseleave',function(e){
354		e.preventDefault();
355		if($('.popup_control .btn_popup_start').is(':visible') === true) { // 이전, 다음 버튼 오버시 슬라이드가 정지상태라면
356			popup_slide.stopAuto();
357		} else {
358			popup_slide.startAuto();
359		}    
360	});
361
362	var popup_active_key;
363	$(".results_data li:last-child a").on("keydown",function(e){
364		console.log(e.keyCode);
365		if(e.keyCode == 9 && !e.shiftKey ){
366			popup_slide.reloadSlider({
367				auto: false,
368				infiniteLoop: false,
369				speed: 0,
370				controls: false,
371				autoControls: false,
372				autoHover: false,
373				pager: false,
374			});
375			setTimeout(function(){
376				$(".popup_slide > li:first-child > a").focus();
377			},200);
378			$(".popup_btn > a").remove();
379			$(".popup_btn").prepend("<a href='#none' class='btn_popup_next'>다음</a>");			
380			$(".popup_btn").prepend("<a href='#none' class='btn_popup_prev'>이전</a>");
381			//$(".popup_control").hide();
382			$(".popup_slide > li > a").on("focusin", function(e){
383				e.preventDefault();
384				var idx = $(this).parent().index()+1;
385				popup_active_key = idx - 1;
386			});
387			$(".btn_popup_prev").bind("click",function(e){
388				e.preventDefault();
389				if(popup_active_key==0){
390				}else{
391				  var slideNum = popup_active_key - 1;
392				  $(".popup_slide > li > a").removeClass("on");
393				  $(".popup_slide > li:eq("+slideNum+") > a").trigger("focus").addClass("on");
394				  $(this).focus();
395				}
396			});
397			$(".btn_popup_next").bind("click",function(e){
398				e.preventDefault();
399				lastSlide = $(".popup_slide > li").length;
400				if(popup_active_key==lastSlide){
401				}else{
402					var slideNum = popup_active_key + 1;
403					$(".popup_slide > li > a").removeClass("on");
404					$(".popup_slide > li:eq("+slideNum+") > a").trigger("focus").addClass("on");
405					$(this).focus();
406				}
407			});
408			$(".popup_slide a:first-child").on("keyup",function(e){
409				if(e.keyCode == 9 && !e.shiftKey ){
410					$(".popup_slide > li > a").removeClass("on");
411				}
412			});
413		}
414	});
415	
416	$('#power_nav001').keyup(function(e){
417		if(e.keyCode === 9){
418			$('#power_nav001').attr('title','선택됨');
419			$('#power_nav002').removeAttr('title');    
420			$('#power_nav003').removeAttr('title');
421			$('#power_nav004').removeAttr('title');			
422		}
423	});
424	
425	$('#power_nav002').keyup(function(e){
426		if(e.keyCode === 9){
427			$('#power_nav002').attr('title','선택됨');
428			$('#power_nav001').removeAttr('title');    
429			$('#power_nav003').removeAttr('title');
430			$('#power_nav004').removeAttr('title');			
431		}
432	});
433	
434	$('#power_nav003').keyup(function(e){
435		if(e.keyCode === 9){
436			$('#power_nav003').attr('title','선택됨');
437			$('#power_nav002').removeAttr('title');    
438			$('#power_nav001').removeAttr('title');
439			$('#power_nav004').removeAttr('title');			
440		}
441	});
442	
443	$('#power_nav004').keyup(function(e){
444		if(e.keyCode === 9){
445			$('#power_nav004').attr('title','선택됨');
446			$('#power_nav002').removeAttr('title');    
447			$('#power_nav003').removeAttr('title');
448			$('#power_nav001').removeAttr('title');			
449		}
450	});
451
452	//What's News
453	$('.latest .group:first-of-type').addClass('active');
454	$('.latest .group .label').on('click', function(){
455		$(this).parent().addClass('active').siblings().removeClass('active');
456		return false;
457	});
458    $('.latest .conBox li').each(function(){
459		if ( $(this).find('span').hasClass('img') == true )
460		{
461			$(this).addClass('img_st');
462		}
463    });
464
465
466	//footbanner
467	var banner_slide = $('.banner_slide').bxSlider({
468		touchEnabled: true,
469		auto: true,
470        autoHover: true,
471		pager: false,
472		controls: false,
473		autoControls: true,
474		maxSlides: 10,
475		minSlides: 4,
476		moveSlides: 1,
477		slideWidth: 800,
478		pause: 3000,
479	});
480
481	$('.banner_btn > a').on('click', function(){
482		if($(this).hasClass('prev') == true){
483			banner_slide.goToPrevSlide();
484			banner_slide.stopAuto();
485		}else if($(this).hasClass('next') == true){
486			banner_slide.goToNextSlide();
487			banner_slide.stopAuto();
488		}
489	});
490
491	$('.btn_banner_start').on('click',function(){
492		$(this).css('display','none');
493		$('.btn_banner_stop').css('display','block');
494		$('.btn_banner_stop').focus();
495		banner_slide.startAuto();
496		return false;
497	});
498	$('.btn_banner_stop').on('click',function(){
499		$(this).css('display','none');
500		$('.btn_banner_start').css('display','block');
501		$('.btn_banner_start').focus();
502		banner_slide.stopAuto();
503		return false;
504	});
505
506	$('.banner_control > a').bind('mouseenter',function(e){
507		e.preventDefault();
508		banner_slide.stopAuto();    
509	});
510	$('.banner_control > a').bind('mouseleave',function(e){
511		e.preventDefault();
512		if($('.banner_control .btn_banner_start').is(':visible') === true) { // 이전, 다음 버튼 오버시 슬라이드가 정지상태라면
513			banner_slide.stopAuto();
514		} else {
515			banner_slide.startAuto();
516		}    
517	});
518
519	var banner_active_key;
520	$(".section05 .go_scroll").on("keydown",function(e){
521		if(e.keyCode == 9 && !e.shiftKey ){
522			banner_slide.reloadSlider({
523				auto: false,
524				infiniteLoop: false,
525				maxSlides: 10,
526				minSlides: 2,
527				moveSlides: 1,
528				slideWidth: 160,
529				pager: false,
530				controls: false
531			});
532			setTimeout(function(){
533				$(".banner_slide > li:first-child > a").focus();
534			},200);
535			$(".banner_btn > a").remove();
536			$(".banner_btn").prepend("<a href='#none' class='btn_banner_next'>다음</a>");
537			$(".banner_btn").prepend("<a href='#none' class='btn_banner_prev'>이전</a>");
538			//$(".banner_control").hide();
539			$(".banner_slide > li > a").on("focusin", function(e){
540				e.preventDefault();
541				var idx = $(this).parent().index()+1;
542				banner_active_key = idx - 1;
543			});
544			$(".btn_banner_prev").bind("click",function(e){
545				e.preventDefault();
546				if(banner_active_key==0){
547				}else{
548				  var slideNum = banner_active_key - 1;
549				  $(".banner_slide > li > a").removeClass("on");
550				  $(".banner_slide > li:eq("+slideNum+") > a").trigger("focus").addClass("on");
551				  $(this).focus();
552				}
553			});
554			$(".btn_banner_next").bind("click",function(e){
555				e.preventDefault();
556				lastSlide = $(".banner_slide > li").length;
557				if(banner_active_key==lastSlide){
558				}else{
559					var slideNum = banner_active_key + 1;
560					$(".banner_slide > li > a").removeClass("on");
561					$(".banner_slide > li:eq("+slideNum+") > a").trigger("focus").addClass("on");
562					$(this).focus();
563				}
564			});
565			$(".banner_btn a:first-child").on("keyup",function(e){
566				if(e.keyCode == 9 && !e.shiftKey ){
567					$(".banner_slide > li > a").removeClass("on");
568				}
569			});
570		}
571	});
572	
573	
574	/* 동영상 레이어팝업 삭제됨
575	$(".btn_main_play a").click(function(){
576	    $(".main_video").fadeIn("200");
577	    $(".btn_main_play a").addClass("stop");
578	    $(".main_video .close").focus();
579	});
580	
581	$(".close").click(function(){
582	    $(".main_video").fadeOut("200");
583	    $(".btn_main_play a").removeClass("stop");
584	    $(".btn_main_play a").focus();
585	});
586	*/
587});
588
589

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.