/* *******************************************************
* filename : common.js
* description : �꾩²´�곸쑝ë¡� �¬ì슜�섎뒗 JS
* date : 2020-02-24
******************************************************** */
/* IE ë²꾩쟾Òú´í겕 */
function ieVersionCheck () {
var word;
var version = "N/A";
var agent = navigator.userAgent.toLowerCase();
var name = navigator.appName;
// IE old version ( IE 10 or Lower )
if ( name == "Microsoft Internet Explorer" ) word = "msie ";
else {
// IE 11
if ( agent.search("trident") > -1 ) word = "trident/.*rv:";
// Microsoft Edge
else if ( agent.search("edge/") > -1 ) word = "edge/";
}
var reg = new RegExp( word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})" );
if ( reg.exec( agent ) != null ) version = RegExp.$1 + RegExp.$2;
if ( version !="NaN" && version < 12 ) {
return parseInt (version)
}else {
return false;
}
}
function detectBrowser() {
var word;
var versionOrType = "another";
var ieName = navigator.appName;
var agent = navigator.userAgent.toLowerCase();
/*** 1. IE ë²꾩쟾 Òú´í겕 ***/
// IE old version ( IE 10 or Lower )
if ( ieName == "Microsoft Internet Explorer" ){
word = "msie ";
}else{
// IE 11
if( agent.search("trident") > -1 ) word = "trident/.*rv:";
// IE 12 ( Microsoft Edge )
else if( agent.search("edge/") > -1 ) word = "edge/";
}
var reg = new RegExp( word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})" );
if ( reg.exec( agent ) != null )
versionOrType = RegExp.$1 + RegExp.$2;
/*** 2. IEê°� �꾨땶 ê²½ì슦 ë¸뚮씪�°ì� Òú´í겕 ***/
if( versionOrType == "another" ){
if (agent.indexOf("chrome") != -1) versionOrType = "Chrome";
else if (agent.indexOf("opera") != -1) versionOrType = "Opera";
else if (agent.indexOf("firefox") != -1) versionOrType = "Firefox";
else if (agent.indexOf("safari") != -1) versionOrType = "Safari";
else if (agent.indexOf("mozilla/5.0") != -1) versionOrType = "Mozilla";
}
return versionOrType;
};
/* Window Popup Open */
function winPopupOpen(src,title,option){
window.open(src,title,option);
}
/* Òï¨ë컮��/PC Òú´í겕 */
function isMobile(){
var UserAgent = navigator.userAgent;
if (UserAgent.match(/iPhone|iPad|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson/i) != null || UserAgent.match(/LG|SAMSUNG|Samsung/) != null)
{
return true;
}else{
return false;
}
}
/* �꾩쓽�� �곸뿭�� ׺뚮뱾�� �¤í겕롤ë컮 �¬ê¸° ×å¡ì젙 */
function getScrollBarWidth(){
if($(document).height() > $(window).height()){
$('body').append('
');
fakeScrollBar = $('#fakescrollbar');
fakeScrollBar.append('
');
var w1 = fakeScrollBar.find('div').innerWidth();
fakeScrollBar.css('overflow-y', 'scroll');
var w2 = $('#fakescrollbar').find('div').html('html is required to init new width.').innerWidth();
fakeScrollBar.remove();
return (w1-w2);
}
return 0;
}
/* ë¸뚮씪�°ì� ê°�ë¡�, �¸ë줈�¬ê¸° ×å¡ì젙 */
function getWindowWidth () {
return $(window).outerWidth() + getScrollBarWidth() ;
}
function getWindowHeight () {
return $(window).height() ;
}
/* ë¸뚮씪�°ì� �¤í겕롤ì쐞ì¹� ×å¡ì젙 */
function getScrollTop () {
return $(window).scrollTop();
}
/* ë¸뚮씪�°ì� �¤í겕ë¡� �꾩튂 �´ë룞 */
function moveScrollTop (top) {
$("html, body").animate({scrollTop:top},500,"swing");
}
/* addClass Active */
function addActive (activeItem) {
$(activeItem).addClass("active");
}
/* selector length */
$.exists = function(selector) {
return ($(selector).length > 0);
}
/* AOS Plugin */
function aosInit () {
var browserVer = ieVersionCheck();
if ( !browserVer || browserVer > 9 ) {
AOS.init({
// Global settings:
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
startEvent: 'DOMContentLoaded', // name of the event dispatched on the document, that AOS should initialize on
initClassName: 'aos-init', // class applied after initialization
animatedClassName: 'aos-animate', // class applied on animation
useClassNames: false, // if true, will add content of `data-aos` as classes on scroll
disableMutationObserver: false, // disables automatic mutations' detections (advanced)
debounceDelay: 50, // the delay on debounce used while resizing window (advanced)
throttleDelay: 99, // the delay on throttle used while scrolling the page (advanced)
// Settings that can be overridden on per-element basis, by `data-aos-*` attributes:
offset: 150, // offset (in px) from the original trigger point
delay: 0, // values from 0 to 3000, with step 50ms
duration: 1000, // values from 0 to 3000, with step 50ms
easing: 'ease', // default easing for AOS animations
once: true, // whether animation should happen only once - while scrolling down
mirror: false, // whether elements should animate out while scrolling past them
anchorPlacement: 'top-bottom', // defines which position of the element regarding to window should trigger the animation
});
}
}
/* magnificPopup Plugin */
function magnificPopup (popupGallery) {
$(popupGallery).magnificPopup({
delegate: 'a',
type: 'image',
closeOnContentClick: true,
closeBtnInside: true,
fixedContentPos: true,
mainClass: 'mfp-with-zoom',
removalDelay: 500, //delay removal by X to allow out-animation
callbacks: {
beforeOpen: function() {
// just a hack that adds mfp-anim class to markup
this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
this.st.mainClass = this.st.el.attr('data-effect');
}
},
closeOnContentClick: true,
midClick: true, // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
});
}
/* Custom Scrollbar Plugin (x,y) */
function customScrollX (scrollObject) {
$(scrollObject).mCustomScrollbar({
axis:"x",
theme:"dark"
});
}
function customScrollY (scrollObject) {
$(scrollObject).mCustomScrollbar({
axis:"y",
theme:"dark"
});
}
/* PHP Get Parameter */
function getParameter(strParamName){
var arrResult = null;
if(strParamName){
arrResult = location.search.match(new RegExp("[&?]" + strParamName + "=(.*?)(&|$)"));
}
return arrResult && arrResult[1] ? arrResult[1] : null;
}
function toAnchorParameter (anchor) {
if ( getParameter(anchor) ) {
var anchorConTop = $("#"+getParameter(anchor)+"").offset().top;
var headerHeight = $("#header").height();
//moveScrollTop(anchorConTop-headerHeight);
if ($.exists('#fullpage')) {
$.fn.fullpage.moveTo(getParameter(anchor));
}else {
$("html, body").animate({scrollTop:anchorConTop-headerHeight},0,"swing");
}
}
}
jQuery(function($){
/* *********************** �곷떒 :: �¤ë뜑 FIXED ************************ */
if ($.exists('#header')) {
$(window).scroll(function () {
var startTop = $("#header").height();
if ( getScrollTop() > startTop ) {
if (!($("#header").hasClass("fixed"))) {
$("#header").addClass("fixed");
}
}else {
if ($("#header").hasClass("fixed")) {
$("#header").removeClass("fixed");
}
}
});
}
/* *********************** �곷떒 :: �¸ì뼱 Òï©ë줉 ************************ */
$(".header-lang").click(function () {
$(this).toggleClass("open");
}).mouseleave(function () {
$(this).removeClass("open");
});
/* *********************** �곷떒 :: ê²��� toggle ************************ */
$(".header-search-box").each(function () {
var $searchBox = $(this);
var $openBtn = $(this).find(".header-search-open-btn");
var $closeBtn = $(this).find(".header-search-close-btn");
$openBtn.click(function () {
$searchBox.addClass("open");
});
$closeBtn.click(function () {
$searchBox.removeClass("open");
});
});
/* *********************** �섎떒 :: topë²꾪듉 ************************ */
$(".to-top-btn").each(function () {
// topë²꾪듉 �섏삤ê²� (�꾩슂�� ê²½ì슦�먮쭔 �£ì쑝�¸ì슂)
if ( $(this).length > 0 ) {
$(window).scroll(function () {
if ( getScrollTop() > 0 ) {
if (!($(".to-top-btn").hasClass("fixed"))) {
$(".to-top-btn").addClass("fixed");
}
}else {
if ($(".to-top-btn").hasClass("fixed")) {
$(".to-top-btn").removeClass("fixed");
}
}
});
}
// topë²꾪듉 �´ë¦
$(this).on("click",function () {
if ($.exists('#fullpage')) {
$.fn.fullpage.moveTo(1);
}else {
moveScrollTop(0);
}
return false;
});
});
/* *********************** �섎떒 :: �뚰듃�덉궗 리ì뒪�� ************************ */
$('.footer-partner-list').slick({
slidesToShow: 7,
slidesToScroll: 1,
arrows: true,
fade: false,
dots:false,
autoplay: true,
speed:500,
infinite:true,
autoplaySpeed: 3000,
easing: 'easeInOutQuint',
pauseOnHover:false,
prevArrow: '',
nextArrow: '',
responsive: [
{
breakpoint: 1367,
settings: {
slidesToShow: 5
}
},
{
breakpoint: 1025,
settings: {
slidesToShow: 3
}
}
]
});
/* *********************** �섎떒 :: �¨ë�리ì궗�´í듃 ************************ */
$(".family-site-box").each(function () {
var $familyBox = $(this);
var $familyListOpenBtn = $(this).children(".family-site-open-btn");
var $familyList = $(this).children(".family-site-list");
$familyListOpenBtn.click(function () {
$familyList.slideToggle(500);
$familyBox.toggleClass("open");
return false;
});
$(this).mouseleave(function () {
$familyList.slideUp(500);
$familyBox.removeClass("open");
});
});
/* *********************** �� ê³µí넻 ************************ */
$(".cm-tab-container").each(function () {
var $cmTabList = $(this).children(".cm-tab-list");
var $cmTabListli = $cmTabList.find("li");
var $cmConWrapper = $(this).children(".cm-tab-content-wrapper");
var $cmContent = $cmConWrapper.children(".cm-tab-con");
// �� �곸뿭 �¨ê¸°ê³� selected �´ë옒�¤ê� �덈뒗 �곸뿭׺� ë³´ì씠ê²�
var $selectCon = $cmTabList.find("li.selected").find("a").attr("href");
$cmContent.hide();
$($selectCon).show();
$cmTabListli.children("a").click(function () {
if ( !$(this).parent().hasClass("selected")) {
var visibleCon = $(this).attr("href");
$cmTabListli.removeClass("selected");
$(this).parent("li").addClass("selected");
$cmContent.hide();
$(visibleCon).fadeIn();
}
return false;
});
});
/* *********************** FAQ ************************ */
$(".faq-list-con .faq-item > dt").click(function () {
var $faqCon = $(this).siblings();
if ($faqCon.css("display") == "block") {
$(this).siblings().slideUp();
$(".faq-item").removeClass("open");
}else {
$(".faq-item > dd:visible").slideUp();
$(".faq-item").removeClass("open");
$(this).parent("dl").addClass("open");
$faqCon.slideDown();
}
});
});
$(window).load(function () {
/* *********************** �쒗럹�´ì� �´ì뿉�쒖쓽 주ì냼 �´ë룞 ************************ */
toAnchorParameter("anchor"); /* 주ì냼~?anchor=content */
/* *********************** AOS Plugin ************************ */
aosInit ();
});
$(function() {
$(".family > a").click(function() {
if(!$(this).siblings('.dropdown').is(':visible')) {
$(this).siblings('.dropdown').stop(true,false).slideDown(500);
} else {
$(this).siblings('.dropdown').stop(true,false).slideUp(500);
}
});
});