/* ---------- js ---------- */ jQuery(function ($) { /* 모바일 메뉴 열기 */ function mNav_open() { $(".btn-nav").addClass("mNav_open"); $("#header .navWrap").addClass("mNav_open"); $(".gnbMenuBg").fadeIn(); } function mNav_close() { $(".btn-nav").removeClass("mNav_open"); $("#header .navWrap").removeClass("mNav_open"); $(".gnbMenuBg").fadeOut(); } $(".btn-nav").click(function () { if (!$(this).hasClass("mNav_open")) { mNav_open(); } else { mNav_close(); } }); $(".gnbMenuBg,.mobile-header-close,.navWrap .navbar-nav > li > a,.header-go-to-top").click(function () { mNav_close(); }); $(window).resize(function () { if ($(window).width() > 991) { mNav_close(); }; }); $(window).scroll(function () { if ($(this).scrollTop() > 150) $('.go-to-top').fadeIn('slow'); else $('.go-to-top').fadeOut('slow'); }); $('.header-go-to-top').click(function () { $("html, body").animate({ scrollTop: 0 }, 500); return false; }); $('.go-to-top').click(function () { $("html, body").animate({ scrollTop: 0 }, 500); return false; }); }); jQuery(function ($) { // init Isotope var initial_items = 8; var next_items = 4; var $grid = $('.portfolio-grid').isotope({ itemSelector: '.element-item', layoutMode: 'masonry', stamp: '.element-item--static' }); function showNextItems(pagination) { var itemsCount = 0; $('.visible_item').each(function () { if (itemsCount < pagination) { $(this).removeClass('visible_item'); itemsCount++; } }); $grid.isotope('layout'); } function hideItems(pagination) { var itemsCount = 0; $('.tabArea > .tabBox.on .element-item').each(function () { if (itemsCount >= pagination) { $(this).addClass('visible_item'); } itemsCount++; }); $grid.isotope('layout'); } $('.tabArea .tabBox.on .showMore').on('click', function (e) { e.preventDefault(); showNextItems(next_items); }); hideItems(initial_items); $(".tabArea .tab li a").on("click", function (e) { // 해당 요소를 클릭하는 내 자신의 index 번호를 가져온다. [0], [1] e.preventDefault(); const num = $(".tabArea .tab li a").index($(this)); // 기존에 적용되어 있는 on class 삭제 $(".tabArea .tab li").removeClass("on"); $(".tabArea .tabBox").removeClass("on"); // 다음 요소 클릭시 on class 추가 $('.tabArea .tab li:eq(' + num + ')').addClass("on"); $('.tabArea .tabBox:eq(' + num + ')').addClass("on"); function showNextItems1(pagination) { var itemsCount = 0; $('.tabArea .tabBox:eq(' + num + ')').find('.visible_item').each(function () { if (itemsCount < pagination) { $(this).removeClass('visible_item'); itemsCount++; } }); $grid.isotope('layout'); } function hideItems1(pagination) { var itemsCount = 0; $('.tabArea .tabBox:eq(' + num + ')').find('.element-item').each(function () { if (itemsCount >= pagination) { $(this).addClass('visible_item'); } itemsCount++; }); $grid.isotope('layout'); } $('.tabBox.on .showMore').on('click', function (e) { e.preventDefault(); showNextItems1(next_items); }); hideItems1(initial_items); }); var top_space = 0; if ($('#header').length) { top_space = $('#header .sub-page-nav').outerHeight(); } //해더에 바가 있는 경우 오프셋 하는 경우 필요 //var hash = window.location.hash; //if (hash && document.getElementById(hash.slice(1))) { // #값이 있을때만 실행됨 // var $this = $(hash); // $('html, body').animate({ // scrollTop: $this.offset().top - top_space // }, 1000, 'easeInOutExpo', function () { // window.history.pushState ? window.history.pushState(null, null, hash) : window.location.hash = hash; // }); //} $('#header .sub-page-nav a').on('click', function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top - top_space }, 1000, 'easeOutCubic'); //숫자는 스크롤 되는 시간, ease머시기는 효과 return false; } } }); }); jQuery(function ($) { var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; $(document).ready(function () { if ($('.photo_output').length) { var $subject = []; $('.photo_output table').each(function (i) { $subject[i] = $(this).find('.board_output_gallery_subject').text(); $(this).find('tr').not(':eq(0)').remove(); $(this).find('tr').eq(0).find('td.board_output_gallery_img > a').append('

' + $subject[i] + '

'); }); } $('td.board_output_gallery_img').each(function (i) { $(this).find('br').remove(); }); $('.photo_output > tbody > tr > td').addClass('wow fadeInUp'); // }); $(document).ready(function () { if ($('.photo_list').length) { var $subject = []; $('.photo_list .bbsnewf5').each(function (i) { $subject[i] = $(this).find('.gallery_title').text(); $(this).find('> table tr').not(':eq(0)').remove(); $(this).find('> table tr').eq(0).find('a').append('

' + $subject[i] + '

'); }); } }); $("img").each(function () { var src = $(this).attr('src'); if (src.indexOf('write.gif') > -1) { $(this).parent('a').addClass('btn btn-primary').text('write'); $(this).remove(); } if (src.indexOf('prev.gif') > -1) { $(this).parent('a').addClass('btn board-arrow board-prev').append(""); $(this).remove(); } if (src.indexOf('list.gif') > -1) { $(this).parent('a').addClass('display-block btn btn-small btn-color1 margin-60px-tb xs-margin-30px-tb margin-lr-auto width-100px').text('list'); $(this).remove(); } if (src.indexOf('move.gif') > -1) { $(this).parent('a').addClass('btn btn-small btn-light-gray').text('move'); $(this).remove(); } if (src.indexOf('copy.gif') > -1) { $(this).parent('a').addClass('btn btn-small btn-light-gray').text('copy'); $(this).remove(); } if (src.indexOf('modify.gif') > -1) { $(this).parent('a').addClass('btn btn-small btn-light-gray').text('modify'); $(this).remove(); } if (src.indexOf('delete.gif') > -1) { $(this).parent('a').addClass('btn btn-small btn-light-gray').text('delete'); $(this).remove(); } if (src.indexOf('next.gif') > -1) { $(this).parent('a').addClass('btn board-arrow board-next').append("");; $(this).remove(); } }); $(document).ready(function () { if ($('.board-category').length) { if ($('.board-category').find('select').length) { var $ca_link = []; var $ca_name = []; var $ca_current = getUrlParameter('com_board_category_code'); var $html = ''; $('.board-category').html($html); $('.board-category ul li').each(function () { if ($(this).find('a').attr('href').indexOf($ca_current) > -1 && $ca_current != '') $(this).addClass('active'); }); if (!$('.board-category .active').length) $('.board-category ul li:first-child').addClass('active'); } else { $('.board-category').remove(); } } }); }); $(document).ready(function () { setCookie(); getCookie(); popupModals(); //쿠키 값 셋팅 및 설정 function setCookie(name, value, expiredays) { var today = new Date(); today.setDate(today.getDate() + expiredays); document.cookie = name + '=' + escape(value) + '; path=/; expires=' + today.toGMTString() + ';' } function getCookie(name) { var cName = name + "="; var x = 0; var i = 0; while (i <= document.cookie.length) { var y = (x + cName.length); if (document.cookie.substring(x, y) == cName) { if ((endOfCookie = document.cookie.indexOf(";", y)) == -1) endOfCookie = document.cookie.length; return unescape(document.cookie.substring(y, endOfCookie)); } x = document.cookie.indexOf(" ", x) + 1; if (x == 0) break; } return ""; } //모달창 function popupModals() { $("div[id^='wb-popup']").each(function () { var _this = this.id; $(function () { //쿠기 값 설정 function closePopupNotToday() { setCookie(_this, 'Y', 1); $("#" + _this).fadeOut(200); } $("#" + _this + " #pos_close_today").click(function () { closePopupNotToday(); }); if (getCookie(_this) != "Y") { $("#" + _this).fadeIn(200); } else { $("#" + _this).hide(); } $("#" + _this + " .close-modal").click(function () { $("#" + _this).fadeOut(200); }); }); }) } });