PageSourceSearch

https://innobranch.com/resources/front/js/ui.js

js innobranch.com collected 2026-10-08 08:26:08 UTC 27,192 bytes, 976 lines download raw bytes

1/* ==============================
2 * 작성일 : 2021-06-01
3 * 작성자 : 안효주, 장영석
4 * 작성자의 허락없이 무단 도용시 고발 조치 합니다.
5 * ============================== */
6
7
8$(function(){
9	/* ==============================
10	 * common
11	 * ============================== */
12	
13	clickMotion();
14	ieScroll();
15	imgChange();
16	//common.init();
17	
18	mobileCheck.init();
19	include.init();
20	layerPopup.init();
21	resize.init();
22	animation.init();
23	formBox.init();
24
25	accodionBox();
26
27	tooltip();
28
29	/* ==============================
30	 * content
31	 * ============================== */
32}); 
33
34const common = {
35	header : function(){
36		$(document).on('click','#headerWrap .gnb li > a',function(){
37			if(!$('html').hasClass('.mobile')){
38				$('#headerWrap .gnbWrap').toggleClass('on');
39				return false;
40			}
41		});
42		
43		$(document).on('click','#headerWrap .btnAllGnb',function(){
44			$(this).toggleClass('active');
45			$('#headerWrap .gnbWrap').toggleClass('active');
46			return false;
47		});
48
49		$(window).scroll(function(){
50			const scrollT = $(window).scrollTop();
51			if(scrollT > 100){
52				$('#headerWrap').addClass('scrollAction');
53			} else {
54				$('#headerWrap').removeClass('scrollAction');
55			}
56		})
57
58	},
59	footer: function(){
60	},
61	init: function(){
62		common.header();
63		common.footer();
64	}
65};
66
67const loading = {
68	open : function(text){
69
70		$('body').append(layerPopHtml());
71		$('body').addClass('scrollLock');
72
73		setTimeout(function(){
74			$('#ladingPop').addClass('on');
75		},10)
76
77		function layerPopHtml(target){
78			let $layout = '<div id="ladingPop" class="layerPopWrap loadingWrap">';
79			$layout += '<div class="bg"></div>';
80			$layout += '<div class="loadingBox">';
81			$layout += '<div class="loading"><i></i><i></i><i></i><i></i></div>';
82			if(text){
83				$layout += '<div class="text">' + text + '</div>';
84			}
85			$layout += '</div></div>';
86			return $layout;
87		};
88	},
89	close : function(){
90		$('#ladingPop').removeClass('on');
91		$('body').removeClass('scrollLock');
92
93		setTimeout(function(){
94			$('#ladingPop').remove();
95		},300);
96	}
97}
98
99const formBox = {
100	input : function(){
101		$('input').on('focusin',function(){
102			if(!$(this).attr('readonly')){
103				$(this).closest('.inputBox').addClass('focus');
104
105				if($(this).val()){
106					inputBtn($(this),true);
107				}else{
108					inputBtn($(this),false);
109				};
110
111				const winW = $(window).outerWidth();
112				if(winW <= 767 && $(this).attr('placeholder')){
113					$('<div class="placeholderTip"></div>').appendTo($(this).closest('.inputBox')).text($(this).attr('placeholder'))
114				}
115			}
116		}).on('focusout',function(){
117			if(!$(this).attr('readonly')){
118				$(this).closest('.inputBox').removeClass('focus');
119				inputBtn($(this),false);
120
121				const winW = $(window).outerWidth();
122				if(winW <= 767 && $(this).attr('placeholder')){
123					$(this).closest('.inputBox').find('.placeholderTip').remove();
124				}
125			}
126		}).on('keyup',function(){
127			if(!$(this).attr('readonly')){
128				if($(this).val()){
129					inputBtn($(this),true);
130				}else{
131					inputBtn($(this),false);
132				};
133			}
134		});
135
136		$(document).on('click','.inputBox .btnClose',function(){
137			$(this).siblings('input').val('');
138			return false;
139		});
140
141		function inputBtn(target,check){
142			if(check){
143				if(target.closest('.inputBox').find('.btnClose').length === 0){
144					if(target.closest('.inputBox').hasClass('right')){
145						target.closest('.inputBox').find('input').before('<button class="btnClose">삭제</button>');
146					}else {
147						target.closest('.inputBox').find('input').after('<button class="btnClose">삭제</button>');
148					}
149				}
150			}else{
151				setTimeout(function(){
152					target.siblings('.btnClose').remove();
153				},300);
154			}
155		}
156
157		/* 비밀번호 */
158		$(document).on('click','.btnPwdShow',function(){
159			if($(this).siblings('input').attr('type') == 'password'){
160				$(this).siblings('input').attr('type','text').closest('.inputBox').addClass('show');
161			}else {
162				$(this).siblings('input').attr('type','password').closest('.inputBox').removeClass('show');
163			}
164			return false;
165		});
166		
167		/* 달력 */
168		$('.datepicker :input').datepicker({
169			dateFormat: 'yy-mm-dd',
170			// prevText: '이전 달',
171			// nextText: '다음 달',
172			// monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
173			// monthNamesShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
174			// dayNames: ['일', '월', '화', '수', '목', '금', '토'],
175			// dayNamesShort: ['일', '월', '화', '수', '목', '금', '토'],
176			// dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
177			// showMonthAfterYear: true,
178			// yearSuffix: '년'
179		})
180
181		$('.datepicker i').click(function(){
182			$(this).siblings(':input').datepicker('show');
183		})
184
185		$('.fileBox :file').change(function(){
186			$(this).siblings(':text').val($(this).val());
187		});
188
189	},
190	select: function(){
191		const target = $('.formBox');
192		target.find('select').on('focusin',function(){
193			$(this).closest('.selectBox').addClass('focus')
194		}).on('focusout',function(){
195			$(this).closest('.selectBox').removeClass('focus')
196		})
197	},
198	textarea : function(){
199		const target = $('.formBox');
200		target.find('textarea').on('focusin',function(){
201			$(this).closest('.textarea').addClass('focus')
202		}).on('focusout',function(){
203			$(this).closest('.textarea').removeClass('focus')
204		})
205	},
206	agreeWrap:function(){
207		$('.agreeWrap').each(function(){
208			const target = $(this);
209			const all = target.find('.agreeAll :checkbox');
210			const length = target.find(':checkbox').length - 1;
211			target.find(':checkbox').on('change',function(){
212				/* 전체메뉴 */
213				if($(this).parent().hasClass('agreeAll')){
214					if($(this).is(':checked')){
215						target.find(':checkbox').each(function(){
216							$(this).prop('checked',true);
217							all.parent().addClass('on')
218						});
219					} else {
220						target.find(':checkbox').each(function(){
221							$(this).prop('checked',false);
222							all.parent().removeClass('on')
223						});
224					}
225				}else {
226					if(target.find(':checkbox:checked').not(all).length == length){
227						all.prop('checked',true);
228						all.parent().addClass('on')
229					}else {
230						all.prop('checked',false)
231						all.parent().removeClass('on')
232					}
233				}
234				/* //전체메뉴 */
235			});
236
237		})
238	},
239	init : function(){
240		formBox.input();
241		formBox.select();
242		formBox.textarea();
243		formBox.agreeWrap();
244	}
245}
246
247const Form = {
248	error: function(target, massege){
249		if(massege){
250			$(target).closest('.formBox').addClass('error');
251			$('<div class="errorText"></div>').appendTo($(target).closest('.formBox')).text(massege);
252		}else{
253			$(target).closest('.formBox').removeClass('error').find('.errorText').remove();
254		}
255	},
256	success:function(target, massege){
257		if(massege){
258			$(target).closest('.formBox').addClass('success');
259			$('<div class="successText"></div>').appendTo($(target).closest('.formBox')).text(massege);
260		}else{
261			$(target).closest('.formBox').removeClass('success').find('.successText').remove();
262		}
263	}
264}
265
266
267const accodionBox = function(){
268	$('.accodionBox .tit a').not('.single a').click(function(){
269		$(this).closest('.accodionBox').toggleClass('on');
270		$(this).closest('.tit').next('.accodionView').slideToggle();
271
272		$(this).closest('.accodionWrap').find('.accodionBox').not($(this).closest('.accodionBox')).removeClass('on').find('.accodionView').slideUp();
273		return false; 
274	});
275};
276
277const tooltip = function(){
278	$(document).on('click','.tooltip',function(){
279		$(this).siblings('.tooltipPop').toggleClass('on');
280		return false;
281	});
282
283	$(document).on('click','.tooltipPop .btnClose',function(){
284		$(this).closest('.tooltipPop').removeClass('on').find('.tooltip').focus();
285		return false;
286	});
287
288	$(document).on('click',function(e){
289		$('.tooltipPop').removeClass('on');
290	}).on('click','.tooltipWrap',function(e){
291		e.stopPropagation();
292	});
293
294	$(document).on('click','.btnShare',function(){
295		$(this).siblings('.sharePop').toggleClass('on');
296		return false;
297	});
298
299	$(document).on('click','.sharePop .btnClose',function(){
300		$(this).closest('.sharePop').removeClass('on').find('.btnShare').focus();
301		return false;
302	});
303
304	$(document).on('click',function(e){
305		$('.sharePop').removeClass('on');
306	}).on('click','.shareWrap',function(e){
307		e.stopPropagation();
308	});
309};
310
311const mobileCheck = {
312	val : {
313		text:null
314	},
315	check : function(){
316		const $agent = navigator.userAgent;
317		const isAndroid = ($agent.match(/Android/i) != null) ? 'android' : null;
318		const isBlackBerry = ($agent.match(/BlackBerry/i) != null) ? 'blackBerry' : null;
319		const isIOS = ($agent.match(/iPhone|iPad|iPod|iOS/i) != null) ? 'ios' : null;
320		const isIPhone = ($agent.match(/iPhone/i) != null) ? 'iphone' : null;
321		const isIPad = ($agent.match(/iPad/i) != null) ? 'ipad' : null;
322		const isOpera = ($agent.match(/Opera Mini/i) != null) ? 'opera' : null;
323		const isWindows = ($agent.match(/IEMobile/i) != null) ? 'windows' : null;
324		const isNaverApp = ($agent.indexOf('NAVER(inapp') !== -1) ? 'naverApp' : null;
325		const isDaumApp = ($agent.match(/DaumApps/i) != null) ? 'daumApp' : null;
326		const isKakaoTalk = ($agent.match(/KAKAOTALK/i) != null) ? 'kakaoTalk' : null;
327		const isAny = (isAndroid || isIOS || isBlackBerry || isOpera || isWindows);
328
329		if(isAny){
330			$('html').addClass('mobile');
331			if(mobileCheck.text){
332				$('html').removeClass(mobileCheck.text.join(' '));
333			}
334			mobileCheck.text = null;
335			mobileCheck.text = [isAndroid, isBlackBerry, isIOS, isIPhone, isIPad, isOpera, isWindows, isNaverApp, isDaumApp, isKakaoTalk];
336			$('html').addClass(mobileCheck.text.join(' '));
337		} else {
338			$('html').removeClass('mobile');
339			if(mobileCheck.text){
340				$('html').removeClass(mobileCheck.text.join(' '));
341			}
342		}
343	},
344	init: function(){
345		mobileCheck.check();
346	}
347};
348
349
350const imgChange = function(){
351	const width = $(window).outerWidth();
352	const mobileW = 767;
353	const tabletW = 1280;
354	$('*[data-pc-image]').each(function(){
355		const $this = $(this);
356		const name = $this.prop('tagName');
357		const pc = $this.data('pc-image');
358		const tablet = $this.data('tablet-image');
359		const mo = $this.data('mo-image');
360
361		change(pc);
362
363		if(tablet){
364			if(width <= tabletW) change(tablet);
365		}
366
367		if(mo){
368			if(width <= mobileW) change(mo);
369		};
370
371		function change(t){
372			if(name === 'IMG'){
373				$this.attr('src',t);
374			}else{
375				$this.css('background-image','url(' + t + ')');
376			}
377		}
378	});
379}
380
381const resize = {
382	winResize:function(){
383		$(window).resize(function(){
384			imgChange();
385			mobileCheck.init();
386		});
387	},
388	init : function(){
389		resize.winResize();
390	}
391}
392
393/* 클릭 모션 */
394const clickMotion = function(){
395	$(window).load(function(){
396		$('.button').each(function(){
397			const $this = $(this);
398			if(!$this.find('.textOver').length){
399				const text = $this.text();
400				$this.text('')
401				$('<div class="textOver"><div></div></div>').appendTo($this).find('>div').text(text);
402			};
403		});
404	});
405
406	$(document).on('mouseenter','.clickMotion, .button',function(e){
407		const $this = $(this),
408			$delay = 650;
409
410		if(!$this.find('.click-in').length) $this.prepend('<i class="click-in"></i>')
411		$this.css('overflow','hidden');
412		const btnIn = $this.find('.click-in'),
413			btnMax = Math.max($this.outerWidth(),$this.outerHeight()),
414			btnX = e.pageX - $this.offset().left - btnMax/2,
415			btnY = e.pageY - $this.offset().top - btnMax/2;
416		
417		btnIn.css({'left':btnX,'top':btnY,'width':btnMax,'height':btnMax})
418			.addClass('animate');
419
420		if(!$this.find('.textOver').length){
421			const text = $this.text();
422			$this.text('')
423			$('<div class="textOver"><div></div></div>').appendTo($this).find('>div').text(text);
424		};
425	});
426	$(document).on('mouseleave','.clickMotion, .button',function(e){
427		$(this).removeAttr('style');
428		$(this).find('.click-in').remove();
429	});
430}
431
432
433/* 내용불러오기 */
434const include = {
435	load: function(){
436		$(window).load(function(){
437			const $include = $('[data-include]');
438			$include.each(function(i,el){
439				const $this = $(this)
440				const src = $this.data('include');
441				$this.load(src,function(){
442					$this.removeAttr('data-include');
443					if($this.attr('id') === 'headerWrap'){
444						const $title = $('#container').data('title');
445						const $headTitle = document.title;
446						if($this && $this !== ''){
447							document.title = $title+' | '+$headTitle;
448						}
449					}
450				});
451			});
452		});
453	},
454	init:function(){
455		include.load();
456	}
457};
458
459
460/* ie 스크롤 */
461const ieScroll = function(){
462	if(navigator.userAgent.match(/Trident\/7\./)){
463		$('html,body').on('mousewheel',function(e){
464			e.preventDefault();
465
466			var wheelDelta = event.wheelDelta;
467			var currentScrollPosition = window.pageYOffset;
468			window.scrollTo(0,currentScrollPosition - wheelDelta);
469		});
470	};
471}
472
473/* 팝업 */
474const layerPopup = {
475	click: function(){
476		$(document).on('click','.popOpen',function(){
477			const $this = $(this);
478			let href = $this.attr('href');
479			if(!href){
480				href = $this.data('href');
481			}
482			layerPopup.open(href,$this);
483			return false;
484		});
485	},
486	open: function(target,el){
487		const cont = $(target).find('.layerPopCont');
488		$(target).addClass('on');
489		setTimeout(function(){
490			cont.focus();
491		},30);
492		$("body").css("overflow","hidden");
493
494		cont.find('.btnPopClose').last().on('keydown',function(e){
495			var code = e.which;
496			if(code == 9){
497				$(this).closest('.layerPopCont').focus();
498			};
499		});
500		layerPopup.close(target,el);
501
502		if($(el).data('video')){
503			const video = $(el).data('video')
504
505			$(target).find('.videoPop iframe').attr('src',video);
506		}
507	},
508	close: function(target,reTarget){
509		let btnTarget = reTarget ? reTarget : '';
510
511		$(target).off('click');
512		$(target).find('.btnPopClose').off('click');
513
514		$(target).find('.btnPopClose').on('click',function(){
515			layerPopup.actionClose(target,reTarget);
516			return false;
517		});
518		$(target).on('click',function(e){
519			if($(e.originalEvent.target).hasClass('layerPopWrap')){
520				layerPopup.actionClose(target,reTarget);
521			}
522		});
523	},
524	actionClose : function(target,reTarget){
525		let btnTarget = reTarget ? reTarget : '';
526		$(target).removeClass('on');
527		$("body").css("overflow","");
528
529		if($(target).find('.videoPop').length){
530			$(target).find('.videoPop iframe').attr('src','').empty();
531		}
532
533		if(reTarget) btnTarget.focus();
534	},
535	init: function(){
536		layerPopup.click();
537	}
538
539} 
540
541/* 동작 인터렉션 */
542const animation = {
543	scrollAni: function(){
544		const $elements = $( '*[data-animation]' );
545		let h = $(window).height();
546		$elements.each( function( i, el ) {
547			const $el = $( el );
548			const animationClass = $el.data('animation').split(',');
549			
550			$el.waypoint(function(i){
551				h = $(window).height();
552				if(i == 'up'){
553					animation.scrollDD('remove',$el, animationClass);
554				}
555				if(i == 'down'){
556					animation.scrollDD('add',$el, animationClass);
557				}
558
559			}, { offset: animation.waypointerCheck($el)[0] +'%',triggerOnce: animation.waypointerCheck($el)[1]});
560		});
561	},
562	scrollChildAni: function(){
563		const $elements = $( '*[data-child-animation]' );
564		let h = $(window).height();
565		$elements.each( function( i, el ) {
566			const $el = $( el );
567			const $child = $el.children();
568			const animationClass = $el.data('child-animation').split(',');
569			
570			$child.each(function(j){
571				const el = $(this);
572				el.css('opacity',0)
573				el.waypoint(function(i){
574					h = $(window).height();
575					if(i == 'up'){
576						el.css('opacity',0)
577						animation.scrollDD('remove',el, animationClass, j);
578					}
579					if(i == 'down'){
580						el.css('opacity',1)
581						animation.scrollDD('add',el, animationClass, j);
582					}
583
584				}, { offset: animation.waypointerCheck(el)[0] +'%',triggerOnce: animation.waypointerCheck(el)[1]});
585			})
586		});
587	},
588	numberCount:function(){
589		const $elements = $( '*[data-count]' );
590		let h = $(window).height();
591
592		$elements.each( function( i, el ) {
593			const $el = $( el );
594			const count = $el.data('count').toString().split(',');
595			let delay = 0;
596			let duration = 800;
597			let fixed = 0;
598			let comma = true;
599			if($el.data('tofixed'))fixed = $el.data('tofixed');
600			if(count[1]) delay = parseInt(count[1]);
601			if(count[2]) duration = parseInt(count[2]);
602			if($el.data('none-comma')){
603				comma = false;
604			}
605			
606			$el.waypoint(function(i){
607				h = $(window).height();
608				if(i == 'up'){
609					$el.text('-');
610				}
611				if(i == 'down'){
612					$el.text('-');
613					$({val:0}).delay(delay).animate({val:count[0]},{
614						duration:duration,
615						step:function(){
616							if(comma){}
617							comma ? $el.text(animation.addComma(this.val.toFixed(fixed))) : $el.text(this.val.toFixed(fixed))
618						},
619						complete:function(){
620							comma ? $el.text(animation.addComma(this.val.toFixed(fixed))) : $el.text(this.val.toFixed(fixed))
621						}
622					});
623				}
624
625			}, { offset: animation.waypointerCheck($el)[0] +'%',triggerOnce: animation.waypointerCheck($el)[1]});
626		});
627	},
628
629	textAnimation: function(){
630
631		const $elements = $( '*[data-text-animation]' );
632		const h = $(window).height();
633
634		$elements.each( function( i, el ) {
635			const $el = $( el );
636			let textAni = $el.data('text-animation'),
637				number = $el.text();
638
639			let _duration = 100,
640				_delay = 0;
641			if($el.data('duration') > 0) _duration = $el.data('duration');
642			if($el.data('delay') > 0) _delay = $el.data('delay');
643
644			$el.addClass(textAni);
645
646			textMotionType($el,_duration,_delay);
647
648			$el.waypoint(function(e){
649				if(e == 'down'){
650					textMotionType($el,_duration,_delay);
651				};
652			}, { offset: animation.waypointerCheck($el)[0] +'%',triggerOnce: animation.waypointerCheck($el)[1]});
653		});
654
655		function textMotionType(target,duration,delay){
656			var timer;
657			var split = target.text().split('');
658			var last = split.length -1;
659		
660			target.text('');
661			target.empty();
662			clearTimeout(timer);
663			$.each(split,function(e){
664				$('<span class="JStextMotion"></span>').appendTo(target).text(split[e]).addClass(split[e] == ' ' ? 'space' : '');
665				setTimeout(function(){
666					timer = setTimeout(function(){
667						target.find('.JStextMotion').eq(target.data('reverse') ? last -e : e).addClass('on');
668					},e*duration);
669				},delay);
670			});
671		}
672	},
673
674	scrollDD:function(i,target,name,idx){
675		if(i == 'add') {
676			target.addClass('animated '+ name[0]);
677			if(name[1]){target.css({'-webkit-animation-delay':name[1]+'ms','animation-delay':name[1]+'ms'})}
678			if(name[2]){target.css({'-webkit-animation-duration':name[2]+'ms','animation-duration':name[2]+'ms'})}
679
680			if(target.parent().data('child-repeat')){
681				const repeat = target.parent().data('child-repeat');
682				let delay = name[1];
683				if(repeat > idx){
684					delay = name[1]*idx;
685				}else {
686					idx = idx % repeat;
687					delay = name[1]*idx;
688				}
689				if(name[1]){target.css({'-webkit-animation-delay':delay+'ms','animation-delay':delay+'ms'})}
690			}
691			
692		} else if(i == 'remove'){
693			target.removeClass('animated '+ name[0]);
694		}
695	},
696	waypointerCheck:function(target){
697		let Wpoint = 100;
698		let Wonce = false;
699		if(target.data('waypoint-point')) Wpoint = target.data('waypoint-point');
700		if(target.data('waypoint-once')) Wonce = target.data('waypoint-once');
701	
702		return [Wpoint,Wonce];
703	},
704
705	addComma:function(num){
706		var regexp = /\B(?=(\d{3})+(?!\d))/g;
707		return num.toString().replace(regexp,',');
708	},
709
710	init : function(){
711		animation.scrollAni();
712		animation.scrollChildAni();
713		animation.numberCount();
714		animation.textAnimation();
715	}
716}
717
718
719const contentMotion = function(){
720	$(window).scroll(function(){
721		const scrollT = $(window).scrollTop();
722		const headerH = $('#headerWrap').outerHeight();
723		if(scrollT > 100){
724			$('#container').addClass('subScroll')
725		}else {
726			$('#container').removeClass('subScroll')
727		}
728	})
729}
730
731
732/* 팝업 플러그인 */
733;(function($){
734	$.fn.alert = function(options){
735		let settings = $.extend({
736			noIcon: false,
737			buttons : 1,
738			buttonText : ['확인'],
739			buttonClose : 1,
740			text : 'alert내용입니다 <br /> html 태그로 넣어주시면 됩니다.',
741			textAlign : 'center',
742			submit : function(){ console.log('전송버튼호출') },
743			close : function(){ console.log('닫기버튼호출')}
744		},options);
745		
746		return this.each(function(){
747			const _this = $(this)
748
749			/* id 경로 */
750			let href = $(this).attr('href');
751			if(!href){
752				href = $(this).data('href');
753			}
754			/*//id 경로 */
755			layerPopInit(href,$(this));
756			layerPopOpen(href,$(this));
757			
758			function layerPopInit(target,change){
759				$(target).remove();
760			}
761			
762			function layerPopOpen(target,change){
763				layerPopAppend(target);
764				$('body').addClass('scrollLock');
765				
766				setTimeout(function(){
767					$(target).addClass('on');
768				},10)
769				
770				setTimeout(function(){
771					$(target).find('.layerPopCont').focus();
772				},30)
773				
774				$(target).find('.btnPopClose').last().on('keydown',function(e){
775					const code = e.which;
776					if(code == 9){
777						$(this).closest('.layerPopCont').focus();
778					};
779				});
780				
781				$(target).find('.btnSubmit').on('click',settings.submit);
782				$(target).find('.btnPopClose').on('click',settings.close);
783				
784				layerPopClose(change);
785			}
786			
787			function layerPopClose(target){
788
789				$(href).find('.btnSubmit').on('click',function(){
790					close($(this));
791					return false;
792				});
793				$(href).find('.btnPopClose').on('click',function(){
794					close($(this));
795					return false;
796				});
797
798				$(document).on('click', href, function(e){
799					if($(e.originalEvent.target).hasClass('layerPopWrap')){
800						$(href).find('.btnPopClose:last').trigger('click');
801						$(document).off('click', href);
802						close($(this));
803					}
804				});
805
806				function close(t){
807					const $this = t;
808					$this.closest('.layerPopWrap').removeClass('on');
809					$('body').removeClass('scrollLock');
810					target.focus();
811
812					$(target).find('.btnSubmit').off('click');
813					$(target).find('.btnPopClose').off('click');
814
815					$(href).remove();
816					/*setTimeout(function(){
817						$(href).remove();
818					},300);*/
819				}
820			}
821			
822			function layerPopAppend(target){
823				$('body').append(layerPopHtml(target));
824				$(target).find('.textBox').css('text-align',settings.textAlign);
825				$(target).find('.btnPopGroup button').eq(settings.buttonClose - 1).addClass('btnPopClose').siblings().addClass('btnSubmit');
826				if(settings.noIcon){
827					$(target).addClass('noIcon')
828				}
829			}
830			
831			function layerPopHtml(target){
832				let $layout = '<div id="' + target.replace('#','') +  '" class="layerPopWrap alertPop">';
833				$layout += '<div class="bg"></div>';
834				$layout += '<div class="layerPopCont" tabindex="0">';
835				$layout += '<div class="contBox">';
836				$layout += '<div class="textBox">' + settings.text +'</div>';
837				$layout += '<div class="btnPopGroup">';
838				if(settings.buttons == 1){
839					$layout += '<button class="button small">' + settings.buttonText + '</button>';
840				}else{
841					$layout += '<button class="button line small">' + settings.buttonText[0] + '</button><button class="button small">' + settings.buttonText[1] + '</button>';
842				}
843				$layout += '</div></div></div></div>';
844				return $layout;
845			};
846			
847		});
848	};
849}(jQuery));
850
851;(function($){
852	$.fn.popup = function(options){
853		let settings = $.extend({
854			full : false,
855			title : '타이틀 영역들어갑니다',
856			text : 'alert내용입니다 <br /> html 태그로 넣어주시면 됩니다.',
857			load : null,
858			remove : false,
859			submit : function(){ console.log('전송버튼호출') },
860			close : function(){ console.log('닫기버튼호출')}
861		},options);
862		
863		return this.each(function(){
864			const _this = $(this)
865
866			/* id 경로 */
867			let href = $(this).attr('href');
868			if(!href){
869				href = $(this).data('href');
870			}
871			/*//id 경로 */
872			layerPopInit(href,$(this));
873			layerPopOpen(href,$(this));
874			
875			function layerPopInit(target,change){
876				if(settings.remove){
877					$(target).remove();
878				}
879			}
880			
881			function layerPopOpen(target,change){
882				if(!$(target).length){
883					layerPopAppend(target);
884				}
885				$('body').addClass('scrollLock');
886				
887				setTimeout(function(){
888					$(target).addClass('on');
889				},10)
890				
891				setTimeout(function(){
892					$(target).find('.layerPopCont').focus();
893				},30)
894				
895				$(target).find('.btnPopClose').last().on('keydown',function(e){
896					const code = e.which;
897					if(code == 9){
898						$(this).closest('.layerPopCont').focus();
899					};
900				});
901				
902				$(target).find('.btnSubmit').on('click',settings.submit);
903				$(target).find('.btnPopClose').on('click',settings.close);
904				
905				layerPopClose(change);
906			}
907			
908			function layerPopClose(target){
909
910				$(href).find('.btnSubmit').on('click',function(){
911					close($(this));
912					return false;
913				});
914				$(href).find('.btnPopClose').on('click',function(){
915					close($(this));
916					return false;
917				});
918
919				$(document).on('click', href, function(e){
920					if($(e.originalEvent.target).hasClass('layerPopWrap')){
921						$(href).find('.btnPopClose:last').trigger('click');
922						$(document).off('click', href);
923
924						close($(this));
925					}
926				});
927
928				function close(t){
929					const $this = t;
930					$this.closest('.layerPopWrap').removeClass('on');
931					$('body').removeClass('scrollLock');
932					target.focus();
933
934					$(target).find('.btnSubmit').off('click');
935					$(target).find('.btnPopClose').off('click');
936
937					if(settings.remove){
938						setTimeout(function(){
939							$(href).remove();
940						},300);
941					}
942				}
943			}
944			
945			function layerPopAppend(target){
946				$('body').append(layerPopHtml(target));
947				if(settings.load){
948					$(target).find('.textBox').load(settings.load);
949				}
950				$(target).find('.textBox').css('text-align',settings.textAlign);
951				$(target).find('.btnPopGroup button').eq(settings.buttonClose - 1).addClass('btnPopClose').siblings().addClass('btnSubmit');
952				if(settings.full){
953					$(target).addClass('full')
954				}
955			}
956			
957			function layerPopHtml(target){
958				let $layout = '<div id="' + target.replace('#','') +  '" class="layerPopWrap bottomPop">';
959				$layout += '<div class="bg"></div>';
960				$layout += '<div class="layerPopCont" tabindex="0">';
961				$layout += '<div class="contBox">';
962				$layout += '<p class="title">' + settings.title  + '</p>';
963				if(settings.load){
964					$layout += '<div class="textBox"></div>';
965				}else{
966					$layout += '<div class="textBox">' + settings.text +'</div>';
967				}
968				$layout += '</div><a href="#" class="btnClose btnPopClose">팝업닫기</a>';
969				$layout += '</div></div>';
970				return $layout;
971			};
972			
973		});
974	};
975}(jQuery));
976// 팝업 플러그인

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.