/*================================================================
PR001 Module JS
Version : 1.0
Release : 2018-01-16
Copyright by DOTPIA All Rights Reserved.
================================================================*/
(function($) {
'use strict';
/*================================
GET URL PARAMETER FUNCTION
================================*/
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return decodeURI(results[1]) || 0;
}
}
/*================================
PREVENT VERTICAL SCROLL FOR CAROUSEL
================================*/
window.blockMenuHeaderScroll = false;
$(window).on('touchstart', function(e) {
if ($(e.target).closest('.owl-carousel').length == 1) {
blockMenuHeaderScroll = true;
}
});
$(window).on('touchend', function() {
blockMenuHeaderScroll = false;
});
$(window).on('touchmove', function(e) {
if (blockMenuHeaderScroll) {
e.preventDefault();
}
});
/*================================
PRELOADER
================================*/
var preloader = $('#preloader');
if(enableLoadEffect == false) preloader.remove();
$(window).bind('load', function() {
preloader.find('.spinner').fadeOut(400);
preloader.delay(400).fadeOut(400, function() {
preloader.remove();
});
});
/*================================
WOW ANIMATION
================================*/
if(useScrollAnimation === true) {
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: 100,
scrollContainer: null
});
wow.init();
} else {
$('.wow').css({visibility:'visible'});
}
/*================================
MAIN PAGE
================================*/
/* Key Visual */
$(document).ready(function() {
$('#keyVisual .owl-carousel').owlCarousel({
loop: true, // ¹«ÇѼøȯ ¿©ºÎ
items: 1, // ¾ÆÀÌÅÛ °³¼ö
margin: 0, // ¾ÆÀÌÅÛ°£ ¿©¹é
smartSpeed: 800, // ½½¶óÀÌµå ¾Ö´Ï¸ÞÀÌ¼Ç ¼Óµµ (´ÜÀ§ : ¹Ð¸®ÃÊ)
cssEase: 'ease-in', // °¡¼Ó ¾Ö´Ï¸ÞÀÌ¼Ç (easing)
nav: true, // Á¿ì ÄÁÆ®·Ñ »ç¿ë ¿©ºÎ
navText: ['', ''], // Á¿ì ÄÁÆ®·Ñ ¹®±¸
autoplay: true, // ÀÚµ¿Àç»ý ¿©ºÎ
autoplayTimeout: keyVisualTimeout, // ÀÚµ¿Àç»ý °£°Ý (´ÜÀ§ : ¹Ð¸®ÃÊ)
autoplayHoverPause: true // ¸¶¿ì½º ¿À¹ö½Ã ÀÚµ¿Àç»ý ÀϽÃÁ¤Áö ¿©ºÎ
});
});
/* Notice Slider */
$(document).ready(function() {
var slideIdx = 0;
var slideWrap = $('#noticeBanner .noticeSlider');
var slideBody = slideWrap.find('table');
var slideItems = slideBody.find('tr');
var slideCount = slideItems.length;
var slideHeight;
var slideDuration;
if(slideWrap.data('duration')) {
slideDuration = slideWrap.data('duration');
} else {
slideDuration = 2500; // ±âº» ÀÚµ¿Àç»ý ÁÖ±â
}
var slideReady = function() {
slideHeight = slideItems.outerHeight();
slideBody.find('tbody').prepend(slideBody.find('tr:last'));
slideBody.css({top:-slideHeight});
};
var noticeSlide = function() {
slideHeight = slideItems.outerHeight();
slideBody.stop().animate({top:-slideHeight}, 500, function() {
slideBody.find('tr:last').after(slideBody.find('tr:first'));
slideBody.css({top:0});
});
};
slideReady();
var autoPlay = setInterval(function() {
noticeSlide();
}, slideDuration);
});
/* Works */
$(document).ready(function() {
var postContent = $('#works.main-section .board_output_gallery_description');
$('#works.main-section .works-items').owlCarousel({
loop: false, // ¹«ÇѼøȯ ¿©ºÎ
margin: 30, // ¾ÆÀÌÅÛ°£ ¿©¹é
smartSpeed: 400, // ½½¶óÀÌµå ¾Ö´Ï¸ÞÀÌ¼Ç ¼Óµµ (´ÜÀ§ : ¹Ð¸®ÃÊ)
cssEase: 'ease-in', // °¡¼Ó ¾Ö´Ï¸ÞÀÌ¼Ç (easing)
autoplay: false, // ÀÚµ¿Àç»ý ¿©ºÎ
dots: false, // ÆäÀÌÁö³×ÀÌ¼Ç »ç¿ë ¿©ºÎ
navText: ['', ''],
responsiveClass: true, // ¹ÝÀÀÇü ó¸® ¿©ºÎ
responsive: {
0: {
items: 1,
nav: true
},
768: {
items: 2,
nav: true
},
1024: {
items: 3,
nav: true
}
}
});
if(postContent.length) postContent.html(postContent.html().replace(/ /gi,''));
});
/* Parallax */
$(document).ready(function() {
$('#parallax.main-section').parallax('50%', 0.3);
});
/* Partners */
$(document).ready(function() {
$('#partners.main-section .partners-items').owlCarousel({
loop: false, // ¹«ÇѼøȯ ¿©ºÎ
margin: 30, // ¾ÆÀÌÅÛ°£ ¿©¹é
smartSpeed: 200, // ½½¶óÀÌµå ¾Ö´Ï¸ÞÀÌ¼Ç ¼Óµµ (´ÜÀ§ : ¹Ð¸®ÃÊ)
dots: true, // ÆäÀÌÁö³×ÀÌ¼Ç »ç¿ë ¿©ºÎ
nav: false, // Á¿ì ÄÁÆ®·Ñ »ç¿ë ¿©ºÎ
responsiveClass: true, // ¹ÝÀÀÇü ó¸® ¿©ºÎ
responsive: {
0: {
items: 2
},
480: {
items: 3
},
768: {
items: 5
},
1024: {
items: 6
}
}
});
});
/*================================
HEADER
================================*/
var scrollTopBtn = $('#btnToTop');
var gnbNav = $('#gnb > li');
var gnbMobile = $('#header nav');
var gnbToggle = $('#nav-toggle');
var gnbMask = $('#header .nav-overlay');
var headerInit = function() {
gnbNav.each(function() {
if ($(this).find('.subnav').length) $(this).addClass('has-subdepth');
});
};
/* sticky header */
var stickyHeader = function() {
var window_w = $(window).width();
var header = $('#header');
var header_h = header.height();
var scrollTop = $(window).scrollTop();
if (window_w > 1024) {
if (scrollTop >= header_h) {
if (!header.hasClass('sticky')) {
header.addClass('sticky');
}
} else {
header.removeClass('sticky');
}
} else {
header.removeClass('sticky');
}
};
/* show gnb */
var showGnb = function() {
gnbToggle.addClass('open');
gnbMobile.stop().slideDown(600, 'easeOutQuint');
gnbMask.stop().fadeIn(600);
};
/* hide gnb */
var hideGnb = function() {
gnbToggle.removeClass('open');
gnbMobile.stop().slideUp(600, 'easeOutQuint');
gnbMask.stop().fadeOut(600);
};
/* hamburger button */
gnbToggle.click(function() {
$('#header .member-wrapper').removeClass('open');
if (!$(this).hasClass('open')) {
showGnb();
} else {
hideGnb();
}
});
/* member function for under pc devices */
$('#header .member-wrapper > a').on('click', function() {
var window_w = $(window).width();
var parent = $(this).parent();
if (window_w < 1025) parent.toggleClass('open');
});
/* gnb click event for under pc devices */
$('#gnb > li > a').click(function(e) {
var window_w = $(window).width();
var parent = $(this).parent();
if (window_w < 1025) {
if (parent.hasClass('has-subdepth')) {
e.preventDefault();
if (!parent.hasClass('open')) {
gnbNav.find('.subnav').stop().slideUp(300);
gnbNav.removeClass('open');
parent.addClass('open');
$(this).siblings('.subnav').stop().slideDown(300);
} else {
parent.removeClass('open');
$(this).siblings('.subnav').stop().slideUp(300);
}
}
}
});
gnbMask.click(function() {
hideGnb();
});
/* go to top button */
var showTopButton = function() {
var header_h = $('#header').height();
var scrollTop = $(window).scrollTop();
if (scrollTop >= header_h) {
if (!scrollTopBtn.hasClass('show')) {
scrollTopBtn.addClass('show');
}
} else {
scrollTopBtn.removeClass('show');
}
};
headerInit();
$(window).bind('scroll', function() {
stickyHeader();
showTopButton();
});
scrollTopBtn.click(function() {
$('html, body').animate({
scrollTop: 0
}, 650, 'easeInOutQuint');
});
/*================================
FOOTER
================================*/
/* family link */
$(document).ready(function() {
$('#footer .family-wrapper > a').click(function() {
$(this).parent().toggleClass('open');
$(this).next('ul').stop().slideToggle(300);
});
});
/* footer navigation */
var footerNav = $('#footer nav > ul > li');
var footerInit = function() {
footerNav.each(function() {
if ($(this).find('.subnav').length) $(this).addClass('has-subdepth');
});
};
var footerNavShow = function() {
footerNav.find('.subnav').removeAttr('style');
footerNav.removeClass('open');
};
footerNav.find('>a').click(function(e) {
var window_w = $(window).width();
if (window_w <= 1024) {
if ($(this).parent().hasClass('has-subdepth')) {
e.preventDefault();
$(this).parent().toggleClass('open');
$(this).siblings('.subnav').stop().slideToggle(400);
}
}
});
footerInit();
footerNavShow();
$(window).bind('resize', function() {
var window_w = $(this).width();
if (window_w > 1024) footerNavShow();
});
/*================================
SUB PAGE
================================*/
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return decodeURI(results[1]) || 0;
}
}
$(document).ready(function() {
var $url = $(location).attr('href');
var depthActive = function() {
var topCount = $("#gnb > li").length,
subCount = 0,
topName = [],
subName = [],
topURL = [],
subURL = [],
topDepth = 0,
subDepth = 0,
topHTML = "",
subHTML = "";
$('#gnb > li').each(function(i) {
topName[i] = $(this).children('a').text();
topURL[i] = $(this).children('a').attr('href');
$(this).find('.subnav').children().each(function() {
if($url.indexOf($(this).find('>a').attr('href')) > -1) {
topDepth = $(this).closest('.has-subdepth').index();
subDepth = $(this).index();
}
});
i++;
});
topHTML += '
';
$("#breadcrumbs .depth1").append(topHTML);
$("#gnb > li:eq(" + topDepth + ")").find('.subnav').children(':not(".depth-title")').each(function(i) {
subCount++;
subName[i] = $(this).find('a').text();
subURL[i] = $(this).find('a').attr('href');
i++;
});
subHTML += '';
$("#breadcrumbs .depth2").append(subHTML);
$("#breadcrumbs .depth1 > a").text($("#gnb > li:eq(" + topDepth + ")").find('a:first').text());
$("#breadcrumbs .depth2 > a").text($("#gnb > li:eq(" + topDepth + ")").find('.subnav').children().eq(subDepth).find('a').text());
};
$("#breadcrumbs .container > div > a").click(function(e) {
e.preventDefault();
if (!$(this).parent().hasClass('open')) {
$("#breadcrumbs .container > div").removeClass('open');
$("#breadcrumbs .container > div > ul").stop().slideUp(350);
$(this).parent().addClass('open');
$(this).siblings('ul').stop().slideDown(350);
} else {
$(this).parent().removeClass('open');
$(this).siblings('ul').stop().slideUp(350);
}
});
$(document).on('click', function(e) {
if (!$(e.target).is('#breadcrumbs .container > div > a, #breadcrumbs .container > div > ul')) {
$("#breadcrumbs .container > div").removeClass('open');
$("#breadcrumbs .container > div > ul").stop().slideUp(350);
}
});
depthActive();
});
/* Sub Navigation Active (Tab Type) */
$(document).ready(function() {
var url = $(location).attr('href');
var navItems = $('#subVisual nav ul > li');
navItems.each(function() {
if(url.indexOf($(this).find('>a').attr('href')) > -1) $(this).addClass('active');
});
$('#subVisual nav > a').text($('#subVisual nav ul > li.active').text());
});
/* Sub Navigation for for under pc devices */
var navWrap = $('#subVisual nav');
var navDrop = navWrap.find('>a');
$(document).ready(function() {
navDrop.click(function() {
$(this).parent().toggleClass('open');
$(this).parent().find('ul').stop().slideToggle(400);
});
}).on('click', function(e) {
if(!$(e.target).is('#subVisual nav>a')) {
navWrap.removeClass('open');
navWrap.find('ul').stop().slideUp(400);
}
});
/* About Company Type2 - skill bar */
$(document).ready(function() {
var skillBar = $('#container .about-skill-type2 .skill>.skill-wrap');
skillBar.each(function() {
var bar = $(this).find('>.progress-bar');
bar.css({width:bar.data('percent') + '%'});
bar.find('>.percent').text(bar.data('percent') + '%');
});
});
/* Subpage Parallax */
$(document).ready(function() {
$('#subVisual').parallax('50%', 0.3);
$('#container .about-video-type2').parallax('50%', 0.3);
$('#container .about-count-type2').parallax('50%', 0.3);
$('#container .business-overview-mid').parallax('50%', 0.3);
$('#container .business-contact').parallax('50%', 0.3);
});
/* About Company Type2 - Promotion Modal */
$(document).ready(function() {
var modal = '';
var modalMask = '';
var modalHTML = '';
var modalBtn = $('#container .about-video-type2 .btn-video');
var openPromotion = function(src) {
if($('#modalPromotion').length) $('#modalPromotion').remove();
modalHTML += '';
modalBtn.addClass('load');
$('body').append(modalHTML);
modalHTML = '';
modal = $('#modalPromotion');
modalMask = modal.find('>.overlay');
modal.find('iframe').load(function() {
setTimeout(function() {
modal.stop().fadeIn('slow').addClass('show');
modalBtn.removeClass('load');
}, 200);
});
modalMask.click(function() {
closePromotion();
});
};
var closePromotion = function() {
modalHTML = '';
modal = $('#modalPromotion');
modal.stop().fadeOut('slow').removeClass('show');
setTimeout(function() {
modal.remove();
modalBtn.removeClass('load');
}, 1000);
};
modalBtn.click(function() {
var src = $(this).data('video-src');
if(!$(this).hasClass('load')) openPromotion(src);
});
});
/* About Company Type2 - number counting */
var counted = false;
$(window).bind('scroll', function() {
if($('#container .about-count-type2').length) {
var counterOffset = $('#container .about-count-type2').offset().top - window.innerHeight;
var scrollTop = $(this).scrollTop();
if(counted == false && scrollTop >= counterOffset) {
$('#container .about-count-type2 span.count').each(function() {
var _this = $(this),
countTo = _this.data('count');
$({
countNum: _this.text()
}).animate({
countNum: countTo
},
{
duration: 2500,
easing: 'swing',
step: function() {
_this.text(Math.floor(this.countNum));
},
complete: function() {
_this.text(this.countNum);
}
});
});
counted = true;
}
}
});
/* About Company Type2 - our team */
$(document).ready(function() {
$('#container .about-team-type2 .team-list').owlCarousel({
loop: false, // ¹«ÇѼøȯ ¿©ºÎ
margin: 30, // ¾ÆÀÌÅÛ°£ ¿©¹é
smartSpeed: 200, // ½½¶óÀÌµå ¾Ö´Ï¸ÞÀÌ¼Ç ¼Óµµ (´ÜÀ§ : ¹Ð¸®ÃÊ)
dots: true, // ÆäÀÌÁö³×ÀÌ¼Ç »ç¿ë ¿©ºÎ
nav: false, // Á¿ì ÄÁÆ®·Ñ »ç¿ë ¿©ºÎ
responsiveClass: true, // ¹ÝÀÀÇü ó¸® ¿©ºÎ
responsive: {
0: {
items: 1
},
480: {
items: 2
},
1024: {
items: 4
}
}
});
});
/* Location */
$(document).ready(function() {
$('#container .location-tab > li').click(function() {
var tabIndex = $(this).index();
var tabContainer = $('#container .location-tab-con');
tabContainer.hide();
tabContainer.eq(tabIndex).fadeIn(400);
$(this).parent().children().removeClass('active');
$(this).addClass('active');
});
});
/* Business Overview */
$(document).ready(function() {
var hoverItem = $("section.business-detail .detail-items > li");
hoverItem.mouseenter(function() {
hoverItem.addClass('off');
$(this).removeClass('off').addClass('on');
}).mouseleave(function() {
hoverItem.removeClass('on off');
});
});
/* Business field */
$(document).ready(function() {
$('section.business-customer .owl-carousel').owlCarousel({
loop: true, // ¹«ÇѼøȯ ¿©ºÎ
items: 1, // ¾ÆÀÌÅÛ °³¼ö
margin: 0, // ¾ÆÀÌÅÛ°£ ¿©¹é
smartSpeed: 800, // ½½¶óÀÌµå ¾Ö´Ï¸ÞÀÌ¼Ç ¼Óµµ (´ÜÀ§ : ¹Ð¸®ÃÊ)
cssEase: 'ease-in', // °¡¼Ó ¾Ö´Ï¸ÞÀÌ¼Ç (easing)
nav: true, // Á¿ì ÄÁÆ®·Ñ »ç¿ë ¿©ºÎ
navText: ['', ''], // Á¿ì ÄÁÆ®·Ñ ¹®±¸
autoplay: false, // ÀÚµ¿Àç»ý ¿©ºÎ,
autoHeight: true // ÀÚµ¿ ³ôÀÌÁ¶Àý ¿©ºÎ
});
});
/*================================
BOARD FUNCTION
================================*/
/* Set table head attribute */
var setRelation = function() {
var board = $("table[class^=tbl-brd]");
var header = board.find('.att_title');
header.each(function() {
$(this).attr('rel', $.trim($(this).text()));
});
}
/* Create category link */
var setCategory = function() {
var cate_name = [];
var cate_id = [];
var cate_link = '';
var cateItems = $(".board-category select option");
var currURL = $(location).attr('pathname');
var param = '?com_board_category_code=';
var currCategory = $.urlParam('com_board_category_code');
if(cateItems.length) {
cateItems.each(function(i) {
cate_id[i] = $(this).val();
cate_name[i] = $(this).text();
i++;
});
cate_link = '';
$(".board-category").html(cate_link);
$(".board-category > ul > li[data-category=" + currCategory + "]").addClass('active');
if(!currCategory) $(".board-category > ul > li:first-child").addClass('active');
}
}
/* FAQ */
var faqPosts = $(".brd-faq .titdesign");
var loadAnswer = function() {
if(faqPosts.length) {
var replyRows = '';
var reply = [];
var replyURL = [];
faqPosts.each(function(i) {
var $this = $(this);
replyURL[i] = $this.find('a').attr('href');
$.ajax({
url: replyURL[i],
async: false,
cache: false,
dataType: 'html',
type: 'GET',
contentType: 'application/x-www-form-urlencoded;charset=euc-kr',
beforeSend: function(jqXHR) {
jqXHR.overrideMimeType('application/x-www-form-urlencoded;charset=euc-kr');
},
success: function(data) {
reply[i] = $(data).find('#post_area').html();
replyRows += '';
replyRows += '';
replyRows += ' A ';
replyRows += '' + reply[i] + ' ';
replyRows += ' | ';
replyRows += '
';
$this.after(replyRows);
replyRows = '';
},
error: function(response) {
console.log(response);
}
})
i++;
});
}
}
faqPosts.click(function(e) {
var row = $(this).find('.bbsnewf5');
if(!$(".board_admin_bgcolor").length) {
e.preventDefault();
if(!row.hasClass('open')) {
$('.bbsnewf5').removeClass('open');
$('.reply-row').removeClass('open');
row.addClass('open');
$(this).next('.reply-row').addClass('open');
} else {
$('.bbsnewf5').removeClass('open');
$(this).next('.reply-row').removeClass('open');
}
}
});
/* Image to button replace (optional) */
var imgToButton = function() {
var inputStyle = $("input[type=image]"),
imgStyle = $("img");
inputStyle.each(function() {
var src = $(this).attr('src');
if(src.indexOf('search.gif') > -1) {
$(this).before('');
$(document).on('click', '#btn-search', function() {
$(this).next('input[type=image]').trigger('click');
});
$(this).hide();
}
if(src.indexOf('confirm.gif') > -1) {
$(this).before('');
$(this).hide();
}
});
imgStyle.each(function() {
var src = $(this).attr('src');
var event = $(this).attr('onclick');
if(src.indexOf('btn_sdel.gif') > -1) {
$(this).before("");
$(this).remove();
}
if(src.indexOf('move.gif') > -1) {
$(this).before("");
$(this).remove();
}
if(src.indexOf('copy.gif') > -1) {
$(this).before("");
$(this).remove();
}
if(src.indexOf('prev.gif') > -1) {
$(this).parent().addClass('btn btn-outline-secondary').text(window.board_button_prev);
}
if(src.indexOf('list.gif') > -1) {
$(this).parent().addClass('btn btn-secondary').text(window.board_button_list);
}
if(src.indexOf('next.gif') > -1) {
$(this).parent().addClass('btn btn-outline-secondary').text(window.board_button_next);
}
if(src.indexOf('spam.gif') > -1) {
$(this).before('');
$(this).remove();
}
if(src.indexOf('modify.gif') > -1) {
$(this).parent().addClass('btn btn-warning').text(window.board_button_modify);
}
if(src.indexOf('delete.gif') > -1) {
$(this).parent().addClass('btn btn-warning').text(window.board_button_remove);
}
if(src.indexOf('reply.gif') > -1) {
$(this).parent().addClass('btn btn-secondary').text(window.board_button_reply);
}
if(src.indexOf('write.gif') > -1) {
$(this).parent().addClass('btn btn-dark').text(window.board_button_write);
}
if(src.indexOf('btn_confirm.gif') > -1) {
$(this).parent().addClass('btn btn-primary btn-lg').text(window.board_button_send);
}
if(src.indexOf('cancel.gif') > -1) {
$(this).parent().addClass('btn btn-secondary btn-lg').text(window.board_button_cancel);
}
});
};
setRelation();
setCategory();
loadAnswer();
if(window.useTextButton === true) imgToButton();
/*================================
FORMMAIL FUNCTION
================================*/
$(document).ready(function() {
/* Set placeholder formmail type2 */
var targetTable = $('.tbl-formmail-v2');
var name = targetTable.find('input[name=name]');
var phone = targetTable.find('input[name=add1]');
var email = targetTable.find('input[name=receiver_email]');
var memo = targetTable.find('textarea[name=description]');
name.attr('placeholder', window.formmail_field_name);
phone.attr('placeholder', window.formmail_field_phone);
email.attr('placeholder', window.formmail_field_email);
memo.attr('placeholder', window.formmail_field_memo);
/* Agreement layer modal */
var agreeModal = $('#agree-popup');
var privacyTextInit = function() {
if($('textarea[rows=9]').length) {
var text = $('textarea[rows=9]').val();
$('#agree-popup .body textarea').val(text);
}
}
// °³ÀÎÁ¤º¸ ¼öÁýµ¿ÀÇ ¿±â
var openPrivacy = function() {
agreeModal.fadeIn(250).addClass('active');
}
// °³ÀÎÁ¤º¸ ¼öÁýµ¿ÀÇ ´Ý±â
var closePrivacy = function() {
agreeModal.fadeOut(250).removeClass('active');
}
$('.formmail-agreement label em').click(function() {
openPrivacy();
});
agreeModal.find('.btn').click(function() {
closePrivacy();
});
$(window).bind('load', function() {
privacyTextInit();
});
});
})(jQuery);