/***************************************************************** deletion of the current branch prohibited powered by nnin ( http://www.nnin.com ) *****************************************************************/ /*jslint browser: true*/ /*global $, jQuery*/ $(function () { /* 상단메뉴관련 */ var gnb = $('.gnb'); var gnbHeight = $(gnb).height(); var topArea = $('.topArea'); var topAreaHeight = topArea.length ? topArea.height() : 0; var headerHeight = gnbHeight; $('#header').height(headerHeight); // header의 높이를 계산된 값으로 설정 $(window).scroll(function () { var scrollTop = $(this).scrollTop(); // 현재 스크롤 위치를 저장합니다. var gnbTop = topArea.length ? gnb.offset().top : 0; // gnb 요소의 상단 위치를 저장합니다. var topAreaTop = topArea.length ? topArea.offset().top : 0; // topArea 요소의 상단 위치를 저장합니다. var gnbOffsetFromTopArea = gnbTop - topAreaTop; // gnb 요소가 topArea로부터 얼마나 떨어져 있는지 계산합니다. if (scrollTop > gnbHeight - 10) { var newPosition = gnbOffsetFromTopArea - topAreaHeight; // 새로운 위치를 계산합니다. gnb.addClass('on').css('top', newPosition + 'px'); // gnb에 'on' 클래스를 추가하고, 새로운 위치를 적용합니다. } else { gnb.removeClass('on').css('top', ''); // 그렇지 않으면 'on' 클래스를 제거하고, 위치를 초기화합니다. } }); function scrollFixed() { var scrollTop = $(this).scrollTop(); var gnbTop = topArea.length ? gnb.offset().top : 0; var topAreaTop = topArea.length ? topArea.offset().top : 0; var gnbOffsetFromTopArea = gnbTop - topAreaTop; if (scrollTop > gnbHeight - 10) { var newPosition = gnbOffsetFromTopArea - topAreaHeight; gnb.addClass('on').css('top', newPosition + 'px'); } else { gnb.removeClass('on').css('top', ''); } } scrollFixed(); /* 상단메뉴 : 모바일에서 하위메뉴 펼치기 */ $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function (event) { event.preventDefault(); event.stopPropagation(); $(this).parent().siblings().removeClass('open'); $(this).parent().toggleClass('open'); }); /**/ $('.nt_quick').on({ mouseover: function () { $(this).find('ul').stop().slideDown(200); }, mouseout: function () { $(this).find('ul').stop().slideUp(400); } }); /**/ $('.nt_project').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(); } } }); /**/ $('.nt_shopping').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(); } } }); /* scrolltop */ $(window).scroll(function () { if ($(this).scrollTop() > 200) { $('.scrollToTop').fadeIn(); } else { $('.scrollToTop').fadeOut(); } }); $('.scrollToTop').click(function () { $('html, body').animate({ scrollTop: 0 }, 800); return false; }); /* 툴팁 */ $(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_copyright').append(' powered by nnin'); $('.n_copyright span').css({ display: 'inline-block' // marginBottom: '5px' }); $('.n_copyright span a').attr('target', '_blank'); /************************************************************ 게시판 ************************************************************/ /*게시판:공통*/ $('.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(); /* 카테고리 > 탭버튼형 : 속성 변경(폰트크기) */ $('.sul_menu').parent('td').find('font').removeAttr('style', ''); $('.sul_menu img').next('a').addClass('on'); /* 댓글영역 ***********************************************/ /* 댓글영역 : 작성 */ $('.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, .n_board_webzine .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'); $('a[href="javascript: history.back()"]').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'); /* 글쓰기 : 취소버튼 (뒤로가기) */ $('a[href="javascript: document.com_board.reset()"]').attr('href', 'javascript:window.history.back();'); /***************************************************************** 일정관리 *****************************************************************/ $('.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(); /***************************************************************** 폼메일 공백제거 *****************************************************************/ // $('.np_form td').each(function () { // $(this).html($(this).html().replace(/ /gi, '')); // }); }); /***************************************************************** des : 디자인모듈 *****************************************************************/ /* de01 */ var nSwiper01 = new Swiper(".de01 .mySwiper", { speed: 1200, keyboard: { enabled: true, }, autoplay: { delay: 4500, disableOnInteraction: false, }, hashNavigation: { watchState: true, }, parallax: true, grabCursor: true, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, loop: true }); /* de02 */ var nSwiper02 = new Swiper('.de02 .mySwiper', { speed: 1200, autoplay: { delay: 4500, disableOnInteraction: false, }, parallax: true, grabCursor: true, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, loop: true }); /* de03 */ var nSwiper03 = new Swiper('.de03 .mySwiper', { speed: 1200, slidesPerView: 1, spaceBetween: 10, // centeredSlides: true, grabCursor: true, autoplay: { delay: 3000, disableOnInteraction: false, }, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 640: { slidesPerView: 1, spaceBetween: 10, }, 768: { slidesPerView: 2, spaceBetween: 20, }, 1024: { slidesPerView: 3, spaceBetween: 30, }, 1300: { slidesPerView: 4, spaceBetween: 40, }, 1920: { slidesPerView: 5, spaceBetween: 50, }, }, loop: true }); /* de09 : 메인페이지에서 6단진열 */ $(function () { $('.ms_de09 .de09 > .row > div').addClass('col-lg-2'); }); /* de24 : 모달/인트로/레이어 팝업 */ $(function () { /**/ $('.de24 .nOpen_popup').modal({ keyboard: true, show: false /* true, false */ }); $('.modal-dialog').draggable({ handle: ".modal-header_nOpen_popup" }); $('.de24 .nOpen_popup').on('hidden.bs.modal', function () { var iframe = $(this).find('iframe'); var videoSrc = iframe.attr('src'); iframe.attr('src', ''); iframe.attr('src', videoSrc); }); /**/ var nSwiper24 = new Swiper('.de24 .mySwiper', { speed: 1000, keyboard: { enabled: true, }, autoHeight: true, autoplay: { delay: 4500, disableOnInteraction: false, }, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, loop: true }); }); /* de40 : 하루닫기 팝업 */ // Function to show the pop-up and overlay function showPopup() { var overlay = document.getElementById('overlay'); var popup = document.getElementById('popup'); if (overlay && popup) { overlay.style.display = 'block'; popup.style.display = 'block'; } } // Function to close the pop-up and overlay function closePopup() { var overlay = document.getElementById('overlay'); var popup = document.getElementById('popup'); if (overlay && popup) { overlay.style.display = 'none'; popup.style.display = 'none'; } } // Function to hide the pop-up for 24 hours function hideFor24Hours() { // Set a cookie with a 24-hour expiration const now = new Date(); const expiryDate = new Date(now.getTime() + 24 * 60 * 60 * 1000); // 24 hours in milliseconds document.cookie = 'popup_hidden=true; expires=' + expiryDate.toUTCString() + '; path=/'; closePopup(); // Close the pop-up } // Function to check if the pop-up should be shown function checkPopup() { var overlay = document.getElementById('overlay'); var popup = document.getElementById('popup'); if (overlay && popup && document.cookie.indexOf('popup_hidden=true') === -1) { showPopup(); } } // Check if the pop-up should be shown when the page loads checkPopup(); // Function to close pop-up when clicking outside of it window.addEventListener('click', function (event) { var popup = document.getElementById('popup'); if (popup && !popup.contains(event.target)) { closePopup(); } }); /***************************************************************** AOS Animate on scroll *****************************************************************/ // AOS 기본값 AOS.init({ duration: 1200 }); /***************************************************************** 서브페이지 > 상단이미지 > 텍스트 효과 *****************************************************************/ // 페이지가 로드될 때 실행되는 함수 window.onload = function() { // h3 요소 선택 후 클래스 추가 var h3Element = document.querySelector('.nt_imgArea .con h3'); h3Element.classList.add('animate__animated', 'animate__fadeInUp'); // p 요소 선택 후 클래스 추가 var pElement = document.querySelector('.nt_imgArea .con p'); pElement.classList.add('animate__animated', 'animate__fadeInDown'); }; /***************************************************************** ****************************************************************** end ****************************************************************** *****************************************************************/