'use strict'; /* top-navigation */ var header = document.querySelector('header'), nav = document.querySelector('nav'); /* nav¿¡ ¸¶¿ì½º ¿Ã¸®¸é header³ôÀÌ°¡ 320px·Î ³ª°¡¸é header³ôÀÌ°¡ 50px·Î º¯°æ */ nav.addEventListener('mouseover', function(){ header.style.cssText = 'height: 320px; background-color: rgba(0,45,87,1)'; }); nav.addEventListener('mouseout', function(){ header.style.cssText = 'height: 111px; background-color: rgba(0,45,87,0)'; }); /* Initialize Swiper */ var swiper = new Swiper(".myswiper", { spaceBetween: 40, centeredSlides: true, autoplay: { delay: 3500, disableOnInteraction: false, }, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, }); /* productSlider */ const productSliderWrap = document.querySelector(".product__wrap"); const productSliderImg = document.querySelector(".product__imgs"); const productSlider = document.querySelectorAll(".product__img"); let currentIndex = 0; let productSliderCount = productSlider.length; setInterval(() => { let nextIndex = (currentIndex + 1) % productSliderCount; //0 1 2 3 4 0 1 2 3 4.... productSlider[currentIndex].style.opacity = "0"; productSlider[nextIndex].style.opacity = "1"; productSlider.forEach(productSlider => { productSlider.style.transition = "all 0.5s"; }); currentIndex = nextIndex; }, 2000); /* ¾ÆÄÚµð¾ð¸Þ´º */ var btnCollapse = document.getElementById("btn-collapse"); var question = document.getElementsByClassName("panel-question"); var heading = document.getElementsByClassName("panel-heading"); var answer = document.getElementsByClassName("panel-body"); function activateQuestion() { for(var i = 0; i < answer.length; i++) { answer[i].style.display = "none"; } var activePanel = document.querySelectorAll(".panel-question.active .panel-body"); for(var i = 0; i < activePanel.length; i++) { activePanel[i].style.display = ""; } } for (var i = 0; i < heading.length; i++) { heading[i].addEventListener('click', function(e) { for (var j = 0; j < question.length; j++) { question[j].classList.remove('active'); } e.target.parentNode.classList.add('active'); activateQuestion(); }); } btnCollapse.addEventListener('click', function() { for(var i = 0; i < answer.length; i++) { answer[i].style.display = "none"; } }); activateQuestion(); $(function(){ /* hamburger animation */ $('.hamburger__button').click(function(ev){ ev.preventDefault(); $(this).toggleClass('active'); $('.hamburger__nav').toggleClass('visible'); }); });