/*jslint browser: true*/ /*global $, jQuery*/ $(function () { /* 메인슬라이딩 시간간격 : de01, de02, de03 공통적용 */ // $('.carousel').carousel({ // interval: 5000 // }); /* 상단고정 */ $(window).scroll(function () { var gnb = $('.gnb'); if ($(this).scrollTop() > 10) { gnb.addClass('on'); gnb.find('.mainmenu').addClass('on'); $('.nt_sitemap').addClass('on'); } else { gnb.removeClass('on'); gnb.find('.mainmenu').removeClass('on'); $('.nt_sitemap').removeClass('on'); } }); /* 네비게이션 2차메뉴 노출 $('.mainmenu ul li').on({ mouseover : function () { $(this).find('.submenu').stop().slideDown(200); }, mouseout : function () { $(this).find('.submenu').stop().slideUp(200); }, click: function () { if ($(window).width() < 768) { $(this).find('> a').attr('href', '#none'); } $(this).toggleClass('s_on'); if ($(this).hasClass('s_on')) { $(this).find('.submenu').slideDown(); $(this).siblings().removeClass('s_on'); } else { $(this).find('.submenu').slideUp(); } } }); */ /**/ $('.nt_quick').on({ mouseover : function () { $(this).find('ul').stop().slideDown(200); }, mouseout : function () { $(this).find('ul').stop().slideUp(400); } }); /**/ $('.nt_shop').on({ mouseover : function () { $(this).find('ul').stop().slideDown(200); }, mouseout : function () { $(this).find('ul').stop().slideUp(400); }, click: function () { $(this).toggleClass('s_on'); if ($(this).hasClass('s_on')) { $(this).find('ul').slideDown(); } else { $(this).find('ul').slideUp(); } } }); /**/ $('.logoArea p').click(function () { $(this).toggleClass('on'); if ($(this).hasClass('on')) { $('.mainmenu').slideDown(); } else { $('.mainmenu').slideUp(); } }); // $('.logoArea .logo').on({ // mouseenter: function () { // $(this).find('.logo_off').stop().animate({ // opacity: 0, // left: 20 // }, 300); // $(this).find('.logo_on').stop().animate({ // opacity: 1, // left: 0 // }, 300); // }, // mouseleave: function () { // $(this).find('.logo_off').stop().animate({ // opacity: 1, // left: 0 // }, 300); // $(this).find('.logo_on').stop().animate({ // opacity: 0, // left: 20 // }, 300); // } // }); /* scrolltop */ $(window).scroll(function () { if ($(this).scrollTop() > 200) { $('.scrollToTop').fadeIn(); } else { $('.scrollToTop').fadeOut(); } }); /* $('.scrollToTop').click(function () { $('html, body').animate({ scrollTop: 0 }, 800); return false; }); */ /**/ $('.n_swap').each(function () { var $this = $(this); $this.bind('mouseenter', function () { var srcArr = $(this).attr('src').split('.'); $(this).attr('src', srcArr[0] + '_on.' + srcArr[1]); $(this).addClass('on'); }).bind('mouseleave', function () { $(this).attr('src', $(this).attr('src').replace('_on', '')); $(this).removeClass('on'); }); }); /* 툴팁 */ $(function () { $('[data-toggle="tooltip"]').tooltip(); }); /* 이미지 확대,축소 */ $('.scaleUp').on({ mouseover: function () { $(this).addClass('on'); }, mouseout: function () { $(this).removeClass('on'); } }); $('.scaleDown').on({ mouseover: function () { $(this).addClass('on'); }, mouseout: function () { $(this).removeClass('on'); } }); /* 효과01 */ $('.effect01').each(function () { $(this).on({ mouseenter: function () { $(this).find('.effect01-box').stop().animate({ bottom: 0, opacity: 1 }, 200); }, mouseleave: function () { $(this).find('.effect01-box').stop().animate({ bottom: -50, opacity: 0 }, 200); } }); $(this).css({ cursor: 'pointer' }); }); /* 효과02 */ $('.effect02').each(function () { $(this).on({ mouseenter: function () { $('.effect02-box').stop().animate({ top: 20, opacity: 0.2 }, 100); $(this).find('.effect02-box').stop().animate({ top: 0, opacity: 1.0 }, 200); }, mouseleave: function () { $('.effect02-box').stop().animate({ top: 10, opacity: 0.8 }, 100); $(this).find('.effect02-box').stop().animate({ top: 10, opacity: 0.8 }, 200); } }); $(this).css({ cursor: 'pointer' }); }); /* 효과03 */ $('.effect03').each(function () { $(this).on({ mouseenter: function () { $(this).find('.effect03-box').stop().animate({ top: '50%', opacity: 1 }, 200); }, mouseleave: function () { $(this).find('.effect03-box').stop().animate({ top: '40%', opacity: 0 }, 200); } }); $(this).css({ cursor: 'pointer' }); }); /* map 지도 : 구글지도 */ $('.map_google').click(function () { $(this).find('iframe').addClass('clicked'); }).mouseleave(function () { $(this).find('iframe').removeClass('clicked'); }); /************************************************************ 게시판 ************************************************************/ /*게시판:공통*/ $('.n_board_txt, .n_board_gallery').find('table[border="1"]').attr('border', '0'); /* 카테고리 영역 ****************************************/ $('form[name=com_board_form]').parent().addClass('categoryArea'); $('form[name=com_board_form]').parent().find('td').removeAttr('align'); // $('form[name=com_board_form]').parent().css('marginBottom', '5px'); // $('form[name=com_board_form]').parent().find('img').remove(); // $('form[name=com_board_form]').parent().find('td > b').remove(); /* 댓글영역 ***********************************************/ /* 댓글영역 : 작성 */ $('.board_comment_bgcolor tbody:not(:first-child)').css({ 'border': '0px solid #f00', 'padding': '0 10px', 'display': 'block' }); /* 댓글영역 : 작성영역 */ $('.comment_txt > textarea').css({ 'margin': '0 0 5px', 'padding': '10px', 'border': '1px solid #ccc', 'height': '100px' }); /* 댓글영역 : 작성영역 : 버튼(댓글달기) */ $('.comment_txt > input[type=image]').css({ 'paddingRight': '10px', 'float': 'left' }); /* 댓글영역 : 댓글목록 */ $('.comment_name').parent('tr').children('td').removeAttr('width'); $('.comment_name').parent('tr').children('td:nth-child(2)').addClass('comment_view'); $('.comment_name').parent('tr').children('td:nth-child(3)').addClass('comment_hour'); /* 댓글영역 : 댓글목록 */ $('.comment_name').parent().parent().parent().parent().parent().parent().parent().addClass('commentArea'); /* 텍스트형 : 글목록 : 최상단 라인영역 */ $('.n_board_txt .bbsno').parents('table').prev().find('td').addClass('board_top_line'); /* 텍스트형 : 글목록 'tr' 선택*/ $('.n_board_txt .bbsno').parent('tr').addClass('tr_line'); /* 텍스트형 : 글목록 : 최상단 구분영역 */ $('.n_board_txt .att_title').parent('tr').addClass('boardTitBar'); /* 텍스트형 : 글목록 : 최상단 행 속성 */ $('.n_board_txt .att_title font').removeAttr('style'); /* 텍스트형 : 글보기 / 글쓰기*/ $('.n_board_txt .board_bgcolor, .n_board_gallery .board_bgcolor').parent('tr').addClass('diviedLine'); /* 텍스트형 : 목록전체영역 : 하단여백*/ $('.boardTitBar').parent().parent().css('marginBottom', '20px'); /* 공통 : 목록 : 하단 영역들 */ $('.paging').css('padding', '10px 0'); $('.paging').parent().parent().parent().prev().css('border', '1px solid #fff'); $('.paging').parent('tr').next().remove(); // 갤러리목록 : 관리자로그인시 게시물체크박스 $('.n_board_gallery').find('input[name=delete_check_notice\\[\\]]').parent('td').addClass('adminCheck'); $('.n_board_gallery').find('input[name=delete_check_notice\\[\\]]').addClass('adminCheckBox'); // 갤러리목록 : 이미지선택(제목을 사용해야 됨) $('.gallery_subject').parent().siblings('tr:first-child').addClass('nSize'); // 갤러리목록 : 사이즈 $('.nSize').parents('.bbsnewf5').parents('td').addClass('boxArea'); // 텍스트 내용 $('.gallery_etc').css('color', '#fff'); /* 폼메일 : 항목의 속성 제거 ***********************************************/ $('.formmail_title_bgcolor font').removeAttr('style'); /* 개인정보 수집동의 영역 */ $('.np_form input[name=com_formmail_check_safe]').closest('table').addClass('personalInformation'); /* 스팸등록방지 영역 */ $('#captcha').closest('tr').addClass('captcha'); /* 폼메일 : 하단버튼영역 : 상단여백 */ $('a[href="javascript: document.com_formmail.reset();"]').parent().addClass('formButton'); /* 폼메일 : 하단버튼영역 : 버튼 : 확인 */ $('.formButton a:first-child img').attr('src', '../img/component/board/board_1/confirm.gif'); /* 폼메일 : 하단버튼영역 : 버튼 : 취소 */ $('.formButton a:last-child img').attr('src', '../img/component/board/board_1/cancel.gif'); /* 글쓰기 : 하단버튼영역의 상단여백 */ $('a[href="javascript: document.com_board.reset()"]').parent().parent().parent().parent().addClass('nbButton'); /* 글보기 : 하단버튼영역 */ $('img[align=absmiddle]').closest('table').parent().parent().parent().parent().addClass('veiwBottonArea'); /* 글보기 : 하단라인 & 글목록리스트 */ $('.veiwBottonArea').siblings('table:last').find('td').css('backgroundColor', '#fff'); /* 글보기 : 하단 버튼 */ $('img[src="/cimg/btn_sdel.gif"]').attr('src', '../img/component/board/board_1/admin_delete.gif'); $('img[src="/cimg/move.gif"]').attr('src', '../img/component/board/board_1/admin_move.gif'); $('img[src="/cimg/copy.gif"]').attr('src', '../img/component/board/board_1/admin_copy.gif'); /***************************************************************** 일정관리 *****************************************************************/ $('.np_schedule table').attr('width', '100%'); $('.np_schedule').find('input[name=subject]').attr('size', '').css('width', '100%'); /***************************************************************** 쇼핑몰 : 페이징 *****************************************************************/ $('.tb_font04').parent().siblings('td[width=1]').remove(); /***************************************************************** Animations *****************************************************************/ var contentWayPoint = function () { $('.animate-box').waypoint(function (direction) { if (direction === 'down' && !$(this.element).hasClass('animatedFast')) { $(this.element).addClass('item-animate'); setTimeout(function () { $('body .animate-box.item-animate').each(function (k) { var el = $(this); setTimeout(function () { var effect = el.data('animate-effect'); if (effect === 'fadeInUp') { el.addClass('fadeInUp animatedFast'); } else if (effect === 'fadeInLeft') { el.addClass('fadeInLeft animatedFast'); } else if (effect === 'fadeInRight') { el.addClass('fadeInRight animatedFast'); } else if (effect === 'fadeInDown') { el.addClass('fadeInDown animatedFast'); } else { el.addClass('fadeInUp animatedFast'); } el.removeClass('item-animate'); }, k * 300, 'easeInOutExpo'); }); }, 80); } }, { offset: '95%' }); }; // Document on load. $(function () { contentWayPoint(); }); }); /***************************************************************** 숫자카운트 (회생진행건수) *****************************************************************/ (function( $ ){ "use strict"; $.fn.counterUp = function( options ) { // Defaults var settings = $.extend({ 'time': 1000, 'delay': 10 }, options); return this.each(function(){ // Store the object var $this = $(this); var $settings = settings; var counterUpper = function() { var nums = []; var divisions = $settings.time / $settings.delay; var num = $this.text(); var isComma = /[0-9]+,[0-9]+/.test(num); num = num.replace(/,/g, ''); var isInt = /^[0-9]+$/.test(num); var isFloat = /^[0-9]+\.[0-9]+$/.test(num); var decimalPlaces = isFloat ? (num.split('.')[1] || []).length : 0; // Generate list of incremental numbers to display for (var i = divisions; i >= 1; i--) { // Preserve as int if input was int var newNum = parseInt(num / divisions * i); // Preserve float if input was float if (isFloat) { newNum = parseFloat(num / divisions * i).toFixed(decimalPlaces); } // Preserve commas if input had commas if (isComma) { while (/(\d+)(\d{3})/.test(newNum.toString())) { newNum = newNum.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2'); } } nums.unshift(newNum); } $this.data('counterup-nums', nums); $this.text('0'); // Updates the number until we're done var f = function() { $this.text($this.data('counterup-nums').shift()); if ($this.data('counterup-nums').length) { setTimeout($this.data('counterup-func'), $settings.delay); } else { delete $this.data('counterup-nums'); $this.data('counterup-nums', null); $this.data('counterup-func', null); } }; $this.data('counterup-func', f); // Start the count up setTimeout($this.data('counterup-func'), $settings.delay); // Destroy waypoint this.destroy(); }; // Perform counts when the element gets into view $this.waypoint({ offset: '100%', handler: counterUpper}); }); }; })( jQuery ); $('.counter').counterUp(); /***************************************************************** 비내리는 효과 *****************************************************************/ (function ($) { // requestAnimationFrame Polyfill (function () { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback, element) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) { clearTimeout(id); }; }()); // Sakura function. $.fn.sakura = function (options) { // We rely on these random values a lot, so define a helper function for it. function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } // Helper function to attach cross-browser events to an element. var prefixes = ['moz', 'ms', 'o', 'webkit', '']; var prefCount = prefixes.length; function prefixedEvent(element, type, callback) { for (var i = 0; i < prefCount; i++) { if (!prefixes[i]) { type = type.toLowerCase(); } element.get(0).addEventListener(prefixes[i] + type, callback, false); } } // Defaults for the option object, which gets extended below. var defaults = { blowAnimations: ['blow-soft-left', 'blow-medium-left', 'blow-hard-left', 'blow-soft-right', 'blow-medium-right', 'blow-hard-right'], className: 'sakura', fallSpeed: 3, maxSize: 14, minSize: 9, newOn: 300, swayAnimations: ['sway-0', 'sway-1', 'sway-2', 'sway-3', 'sway-4', 'sway-5', 'sway-6', 'sway-7', 'sway-8'] }; var options = $.extend({}, defaults, options); // Declarations. var documentHeight = $(document).height(); var documentWidth = $(document).width(); var sakura = $('
'); // Set the overflow-x CSS property on the body to prevent horizontal scrollbars. $('body').css({ 'overflow-x': 'hidden' }); // Function that inserts new petals into the document. var petalCreator = function () { setTimeout(function () { requestAnimationFrame(petalCreator); }, options.newOn); // Get one random animation of each type and randomize fall time of the petals. var blowAnimation = options.blowAnimations[Math.floor(Math.random() * options.blowAnimations.length)]; var swayAnimation = options.swayAnimations[Math.floor(Math.random() * options.swayAnimations.length)]; var fallTime = (Math.round(documentHeight * 0.007) + Math.random() * 5) * options.fallSpeed; var animations = 'fall ' + fallTime + 's linear 0s 1' + ', ' + blowAnimation + ' ' + (((fallTime > 30 ? fallTime : 30) - 20) + getRandomInt(0, 20)) + 's linear 0s infinite' + ', ' + swayAnimation + ' ' + getRandomInt(2, 4) + 's linear 0s infinite'; var petal = sakura.clone(); var size = getRandomInt(options.minSize, options.maxSize); var startPosLeft = Math.random() * documentWidth - 100; var startPosTop = -((Math.random() * 20) + 15); // Apply Event Listener to remove petals that reach the bottom of the page. prefixedEvent(petal, 'AnimationEnd', function () { $(this).remove(); }); // Apply Event Listener to remove petals that finish their horizontal float animation. prefixedEvent(petal, 'AnimationIteration', function (ev) { if ($.inArray(ev.animationName, options.blowAnimations) != -1) { $(this).remove(); } }); petal .css({ '-webkit-animation': animations, '-o-animation': animations, '-ms-animation': animations, '-moz-animation': animations, animation: animations, height: size, left: startPosLeft, 'margin-top': startPosTop, width: size }) .appendTo('body'); }; // Recalculate documentHeight and documentWidth on browser resize. $(window).resize(function () { documentHeight = $(document).height(); documentWidth = $(document).width(); }); // Finally: Start adding petals. requestAnimationFrame(petalCreator); }; }(jQuery)); /***************************************************************** 눈내리는 효과 *****************************************************************/ if (!Date.now) Date.now = function() { return new Date().getTime(); }; (function() { 'use strict'; var vendors = ['webkit', 'moz']; for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { var vp = vendors[i]; window.requestAnimationFrame = window[vp+'RequestAnimationFrame']; window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame'] || window[vp+'CancelRequestAnimationFrame']); } if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy || !window.requestAnimationFrame || !window.cancelAnimationFrame) { var lastTime = 0; window.requestAnimationFrame = function(callback) { var now = Date.now(); var nextTime = Math.max(lastTime + 16, now); return setTimeout(function() { callback(lastTime = nextTime); }, nextTime - now); }; window.cancelAnimationFrame = clearTimeout; } }()); var snowFall = (function(){ function jSnow(){ // local methods var defaults = { flakeCount : 35, flakeColor : '#ffffff', flakeIndex: 999999, flakePosition: 'absolute', minSize : 1, maxSize : 2, minSpeed : 1, maxSpeed : 5, round : false, shadow : false, collection : false, image : false, collectionHeight : 40 }, flakes = [], element = {}, elHeight = 0, elWidth = 0, widthOffset = 0, snowTimeout = 0, // For extending the default object with properties extend = function(obj, extObj){ for(var i in extObj){ if(obj.hasOwnProperty(i)){ obj[i] = extObj[i]; } } }, // For setting CSS3 transform styles transform = function (el, styles){ el.style.webkitTransform = styles; el.style.MozTransform = styles; el.style.msTransform = styles; el.style.OTransform = styles; el.style.transform = styles; }, // random between range random = function random(min, max){ return Math.round(min + Math.random()*(max-min)); }, // Set multiple styles at once. setStyle = function(element, props) { for (var property in props){ element.style[property] = props[property] + ((property == 'width' || property == 'height') ? 'px' : ''); } }, // snowflake flake = function(_el, _size, _speed) { // Flake properties this.x = random(widthOffset, elWidth - widthOffset); this.y = random(0, elHeight); this.size = _size; this.speed = _speed; this.step = 0; this.stepSize = random(1,10) / 100; if(defaults.collection){ this.target = canvasCollection[random(0,canvasCollection.length-1)]; } var flakeObj = null; if(defaults.image){ flakeObj = new Image(); flakeObj.src = defaults.image; }else{ flakeObj = document.createElement('div'); setStyle(flakeObj, {'background' : defaults.flakeColor}); } flakeObj.className = 'snowfall-flakes'; setStyle(flakeObj, {'width' : this.size, 'height' : this.size, 'position' : defaults.flakePosition, 'top' : 0, 'left' : 0, 'will-change': 'transform', 'fontSize' : 0, 'zIndex' : defaults.flakeIndex}); // This adds the style to make the snowflakes round via border radius property if(defaults.round){ setStyle(flakeObj,{'-moz-border-radius' : ~~(defaults.maxSize) + 'px', '-webkit-border-radius' : ~~(defaults.maxSize) + 'px', 'borderRadius' : ~~(defaults.maxSize) + 'px'}); } // This adds shadows just below the snowflake so they pop a bit on lighter colored web pages if(defaults.shadow){ setStyle(flakeObj,{'-moz-box-shadow' : '1px 1px 1px #555', '-webkit-box-shadow' : '1px 1px 1px #555', 'boxShadow' : '1px 1px 1px #555'}); } if(_el.tagName === document.body.tagName){ document.body.appendChild(flakeObj); }else{ _el.appendChild(flakeObj); } this.element = flakeObj; // Update function, used to update the snow flakes, and checks current snowflake against bounds this.update = function(){ this.y += this.speed; if(this.y > elHeight - (this.size + 6)){ this.reset(); } transform(this.element, 'translateY('+this.y+'px) translateX('+this.x+'px)'); this.step += this.stepSize; this.x += Math.cos(this.step); if(this.x + this.size > elWidth - widthOffset || this.x < widthOffset){ this.reset(); } } // Resets the snowflake once it reaches one of the bounds set this.reset = function(){ this.y = 0; this.x = random(widthOffset, elWidth - widthOffset); this.stepSize = random(1,10) / 100; this.size = random((defaults.minSize * 100), (defaults.maxSize * 100)) / 100; this.element.style.width = this.size + 'px'; this.element.style.height = this.size + 'px'; this.speed = random(defaults.minSpeed, defaults.maxSpeed); } }, // this controls flow of the updating snow animateSnow = function(){ for(var i = 0; i < flakes.length; i += 1){ flakes[i].update(); } snowTimeout = requestAnimationFrame(function(){animateSnow()}); } return{ snow : function(_element, _options){ extend(defaults, _options); //init the element vars element = _element; elHeight = element.offsetHeight; elWidth = element.offsetWidth; element.snow = this; // if this is the body the offset is a little different if(element.tagName.toLowerCase() === 'body'){ widthOffset = 25; } // Bind the window resize event so we can get the innerHeight again window.addEventListener('resize', function(){ elHeight = element.clientHeight; elWidth = element.offsetWidth; }, true); // initialize the flakes for(i = 0; i < defaults.flakeCount; i+=1){ flakes.push(new flake(element, random((defaults.minSize * 100), (defaults.maxSize * 100)) / 100, random(defaults.minSpeed, defaults.maxSpeed))); } // start the snow animateSnow(); }, clear : function(){ var flakeChildren = null; if(!element.getElementsByClassName){ flakeChildren = element.querySelectorAll('.snowfall-flakes'); }else{ flakeChildren = element.getElementsByClassName('snowfall-flakes'); } var flakeChilLen = flakeChildren.length; while(flakeChilLen--){ if(flakeChildren[flakeChilLen].parentNode === element){ element.removeChild(flakeChildren[flakeChilLen]); } } cancelAnimationFrame(snowTimeout); } } }; return{ snow : function(elements, options){ if(typeof(options) == 'string'){ if(elements.length > 0){ for(var i = 0; i < elements.length; i++){ if(elements[i].snow){ elements[i].snow.clear(); } } }else{ elements.snow.clear(); } }else{ if(elements.length > 0){ for(var i = 0; i < elements.length; i++){ new jSnow().snow(elements[i], options); } }else{ new jSnow().snow(elements, options); } } } } })();