$(function(){
/* PRIME COMMON : s */
// script break in sub page
if (document.getElementById("isIndex")==null) { return; }
/* 레이어 팝업 */
(function e() {
function t(e) {
e.hide()
}
$(".px-layer-popup .btn-cookie-close").on("click", function(e) {
let i = $(this).closest(".px-layer-popup")
, s = i.attr("id");
e.preventDefault(),
$.cookie(s, "1", {
expires: 1
}),
t(i)
}),
$(".px-layer-popup .btn-normal-close").on("click", function(e) {
let i = $(this).closest(".px-layer-popup");
e.preventDefault(),
t(i)
})
}
)();
/* PRIME COMMON : e */
/* 스크롤 시 이벤트 */
gsap.registerPlugin(ScrollTrigger);
let bannerGsap = gsap.timeline();
bannerGsap.to(".banner-text .word-wrap .word", {scrollTrigger: {trigger: ".banner-text", scrub:3, start: "0% 80%", end: "100% 80%"}, transform: "translateY(0px)", opacity: 1, duration: 1, stagger: 0.1, ease: "power2.out"});
/* MAIN SLIDE swiper */
function main_slider() {
const progressCircle = document.querySelector(".main-slide .autoplay-progress svg.fill");
const autoplayDelay = 3500;
let main_swiper = new Swiper(".main-swiper", {
direction: "vertical",
speed: 1000,
loop: true,
slidesPerView: 1,
spaceBetween: 0,
allowTouchMove: false,
centeredSlides: true,
navigation: {
nextEl: ".main-slide .swiper-button-next",
prevEl: ".main-slide .swiper-button-prev",
},
pagination: {
el: ".main-slide .swiper-pagination",
},
navigation: {
nextEl: ".main-slide .m-next",
prevEl: ".main-slide .m-prev",
},
autoplay: {
delay: autoplayDelay,
disableOnInteraction: false
},
on: {
init : function () {
$('.main-swiper').addClass('load-init');
$(".main-slide .swiper-pagination").append('
');
},
autoplayTimeLeft(swiper, time, percentage) {
progressCircle.style.setProperty("--progress", 1-percentage);
},
slideChange: function(swiper) {
for (let i=0; i < swiper.slides.length; i++) {
let index = swiper.activeIndex==i ? 0 : swiper.activeIndex-i;
let half_height = swiper.height * 0.5;
let translate = index * half_height;
swiper.slides[i].querySelector('.main-slide-bg-wrap').style.transform = 'translate3d(0, ' + translate + 'px, 0)';
$('.main-swiper').removeClass('load-init');
}
$(".swiper-pause").removeClass("stop");
},
touchStart: function(swiper) {
for (let i = 0; i < swiper.slides.length; i++) {
swiper.slides[i].style.transition = '';
}
},
setTransition: function(swiper, speed) {
for (let i = 0; i < swiper.slides.length; i++) {
swiper.slides[i].style.transition = speed + 'ms';
swiper.slides[i].querySelector('.main-slide-bg-wrap').style.transition = speed + 'ms';
}
},
}
});
$(".swiper-pause").on("click", function(e){
$(this).toggleClass("stop");
if ($(this).hasClass("stop")) {
main_swiper.autoplay.pause();
} else {
main_swiper.autoplay.resume();
}
});
}
main_slider();
function init_product_slide() {
if ($(".product .article-list").length == 0) return;
let list = $(".product .article-list > tbody > tr > td");
let html = ``;
let aos_delay = 0;
list.each(function(){
let href = $(this).find("a").attr("href");
let src = $(this).find(".board_output_imgs").attr("src");
let subject_tag = $(this).find(".board_output_gallery_subject a");
let desc_tag = $(this).find(".board_output_gallery_description");
let td = $(this).find("tr:last-child > td");
let subject = subject_tag.text().trim();
let desc = desc_tag.text().trim();
subject_tag.remove();
desc_tag.remove();
let category = td.text().trim();
html += `
`;
aos_delay += 150;
});
html += '
';
$("section.product .product-swiper").html(html);
$("section.product .article-list").remove();
}
init_product_slide();
/* PRODUCT swiper */
var product_swiper = new Swiper(".product-swiper", {
slidesPerView: "auto",
spaceBetween: 15,
slidesOffsetAfter: 15,
resizeObserver: false,
pagination: {
el: ".product .swiper-pagination",
type: "progressbar",
},
navigation: {
nextEl: ".product .p-navi-next",
prevEl: ".product .p-navi-prev",
disabledClass: "p-navi-disabled",
},
});
function init_blog_slide() {
if ($(".blog .article-list").length == 0) return;
let list = $(".blog .article-list tr");
let html = ``;
let aos_delay = 0;
list.each(function(i){
let href = $(this).find("a").attr("href");
let src = $(this).find(".board_output_imgs").attr("src");
let subject = $(this).find("td.bd_out1").text().trim();
let desc = $(this).find("td").eq(2).text().trim();
let date = $(this).find("td").eq(3).text();
let category = $(this).find("td").last().text();
let aos = i < 4 ? `data-aos="fade-zoom-in" data-aos-delay="${aos_delay}" data-aos-easing="ease-out-cubic"` : '';
html += `
`;
});
$("section.blog .blog-swiper .swiper-wrapper").empty().html(html);
aos_delay += 150;
}
init_blog_slide();
/* BLOG swiper */
var blog_swiper = new Swiper(".blog-swiper", {
slidesPerView: 1,
spaceBetween: 0,
resizeObserver: false,
pagination: {
el: ".blog .swiper-pagination",
type: "progressbar",
},
navigation: {
nextEl: ".blog .b-navi-next",
prevEl: ".blog .b-navi-prev",
disabledClass: "b-navi-disabled",
},
breakpoints: {
480: {
slidesPerView: 2,
spaceBetween: 10,
},
768: {
slidesPerView: 3,
spaceBetween: 10,
},
990: {
slidesPerView: 4,
spaceBetween: 15,
},
},
});
function init_notice() {
if ($(".notice .article-list").length == 0) return;
let list = $(".notice .article-list tr");
let html = "";
let aos_delay = 0;
list.each(function(i){
let a = $(this).find("a");
let href = a.attr("href");
let subject = a.text().trim();
let date = $(this).find("td").eq(2).text();
let desc = $(this).find("td").last().text();
let open = i == 0 ? "open" : "";
let line = i == 0 ? "n-line-1" : "n-line-2";
html += `
`;
});
$("section.notice .tbl").html(html);
$("section.notice .article-list").remove();
aos_delay += 150;
}
init_notice();
/* NOTICE open */
$("section.notice .n-title").on("click", function(e){
let a = $(this).closest("div").siblings("div").find(".n-more");
window.location.href = a.attr("href");
});
AOS.init({
duration: 600,
once: true
});
});