(function($) { $('.main-slider').on('init', function(event, slick) { $('.main-slider').find('.slick-current').removeClass('slick-active').addClass('reset-animation'); setTimeout( function() { $('.main-slider').find('.slick-current').removeClass('reset-animation').addClass('slick-active'); }, 1); }); let vh = window.innerHeight * 0.01; document.documentElement.style.setProperty('--vh', vh + 'px'); window.addEventListener('resize', function () { let vh = window.innerHeight * 0.01; document.documentElement.style.setProperty('--vh', vh + 'px'); }); // ¸ÞÀÎ ºñÁÖ¾ó ½½¶óÀÌ´õ $('.main-slider').slick({ fade:true, slidesToShow: 1, draggable:true, speed:1200, lazyLoad: true, autoplay: true, dots: true, autoplaySpeed:4000, pauseOnFocus:false, pauseOnHover:false, pauseOnDotsHover:false, pauseOnArrowsHover:false, appendArrows:$('.arrow-con > .arrows'), prevArrow:'', nextArrow:'', }); $('.main-slider').on('touchstart', e => { $('.main-slider').slick('slickPlay'); }); // OUR WORK ½½¶óÀÌ´õ $('.single-item').slick({ dots: false, centerMode: true, slidesToShow: 1, autoplay: true, speed: 1000, autoplaySpeed: 2500, lazyLoad: false, pauseOnFocus:false, pauseOnHover:false, arrows: true, }); $('.footer-select').on('click','.placeholder',function(){ var parent = $(this).closest('.footer-select'); if ( ! parent.hasClass('is-open')){ parent.addClass('is-open'); $('.footer-select.is-open').not(parent).removeClass('is-open'); }else{ parent.removeClass('is-open'); } }).on('click','ul>li',function(){ var parent = $(this).closest('.footer-select'); parent.removeClass('is-open').find('.placeholder').text( $(this).text() ); }); $(".nav-mobile-button").click(function() { $('.nav-mobile-bar').toggleClass('active'); $('.nav-mobile-menu').toggleClass('active'); }); var currentScrollTop = 0; window.onload = function() { scrollController(); $(window).on('scroll', function() { scrollController(); }); } function scrollController() { currentScrollTop = $(window).scrollTop(); if (currentScrollTop < 0.1) { $('#blog-header-container').css('top', -(currentScrollTop)); $('.header').css('top', 0.1-(currentScrollTop)); if ($('.header').hasClass('fixed')) { $('.header').removeClass('fixed'); $('.header .menu-icon').removeClass('on'); } } else { if (!$('.header').hasClass('fixed')) { $('#blog-header-container').css('top', -0.1); $('.header').css('top', 0); $('.header').addClass('fixed'); $('.header .menu-icon').addClass('on'); } } } jQuery(document).ready(function($){ var current_path =window.location.pathname; console.log(current_path); $('.submenu ul li a[href="'+current_path+'"]').addClass('active'); var search = window.location.search; $('.sul_menu div a[href="'+current_path+search+'"]').parent().addClass('on'); }); $(document).ready(function(){ $("#go-top").hide(); $(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#go-top').fadeIn(); } else { $('#go-top').fadeOut(); } }); $('#go-top a').click(function () { $('body,html').animate({ scrollTop: 0 }); return false; }); }); }); jQuery(document).ready(function($){ var current_path =window.location.pathname; console.log(current_path); $('.sul_menu ul li a[href="'+current_path+'"]').addClass('active'); var code = getParameter('com_board_category_code') if (code) { code = code.split("c")[1] $('.sul_menu a').eq(code).addClass("active_menu") } else { $('.sul_menu a').eq(0).addClass("active_menu") } function getParameter(name) { var half = location.search.split(name + '=')[1]; return half !== undefined ? decodeURIComponent(half.split('&')[0]) : null; } }); // FAQ $(".open").click(function() { var container = $(this).parents(".faq-box"); var answer = container.find(".answer"); var trigger = container.find(".faq-t"); answer.slideToggle(200); if (trigger.hasClass("faq-o")) { trigger.removeClass("faq-o"); } else { trigger.addClass("faq-o"); } if (container.hasClass("expanded")) { container.removeClass("expanded"); } else { container.addClass("expanded"); } }); jQuery(document).ready(function($) { $('.question').each(function() { $(this).attr('data-search-term', $(this).text().toLowerCase() + $(this).find("ptag").text().toLowerCase()); }); $('.live-search-box').on('keyup', function() { var searchTerm = $(this).val().toLowerCase(); $('.question').each(function() { if ($(this).filter('[data-search-term *= ' + searchTerm + ']').length > 0 || searchTerm.length < 1) { $(this).parent().parent().show(); } else { $(this).parent().parent().hide(); } }); }); }); $(function() { $('.dropdown > .caption').on('click', function() { $(this).parent().toggleClass('open'); }); $('.dropdown > .list > .item').on('click', function() { $('.dropdown > .list > .item').removeClass('selected'); }); $(document).on('keyup', function(evt) { if ( (evt.keyCode || evt.which) === 27 ) { $('.dropdown').removeClass('open'); } }); $(document).on('click', function(evt) { if ( $(evt.target).closest(".dropdown > .caption").length === 0 ) { $('.dropdown').removeClass('open'); } }); }); $(function(){ var $refreshButton = $('#refresh'); var $results = $('#css_result'); function refresh(){ var css = $('style.cp-pen-styles').text(); $results.html(css); } refresh(); $refreshButton.click(refresh); // Select all the contents when clicked $results.click(function(){ $(this).select(); }); }); })(jQuery); // --------------------------------------------------------------------------------------------- // "use strict"; // Çì´õ gnb ½ºÅ©¸³Æ® const header = document.querySelector('.header'); const mobileGnb = document.querySelector('.mobile-gnb'); window.addEventListener('DOMContentLoaded', () => { initGnb(header); initMobileGnb(mobileGnb); }) // PC function initGnb(header){ let gnb = header.querySelector('.header-gnb'); let gnbMenus = gnb.querySelectorAll('.gnb-depth-1 .depth-1'); let depthMenus = gnb.querySelectorAll('.gnb-depth-2'); let maxHeight = calculateMaxHeight(); if (window.innerWidth > 1200) { changeMenuHeight(maxHeight); } gnb.addEventListener('mouseenter', (event) => { gnbOpen(header); }); gnb.addEventListener('focusin', (event) => { gnbOpen(header); }); gnb.addEventListener('mouseleave', (event) => { gnbClose(header); }); gnb.addEventListener('focusout', (event) => { gnbClose(header); }); gnbMenus.forEach(menu => { menu.addEventListener('mouseenter', (event) => { menu.classList.add('current'); }); menu.addEventListener('focusin', (event) => { menu.classList.add('current'); }); menu.addEventListener('mouseleave', (event) => { menu.classList.remove('current'); }); menu.addEventListener('focusout', (event) => { menu.classList.remove('current'); }); }); window.addEventListener('resize', function(){ if (window.innerWidth > 1200) { maxHeight = calculateMaxHeight(); changeMenuHeight(maxHeight); } }); function gnbOpen(header){ let headerHeight = maxHeight + 90; // 90Àº Çì´õ¹ÙÀÇ ³ôÀÌ header.style.height = `${headerHeight}px`; header.classList.add('open'); } function gnbClose(header){ header.classList.remove('open'); header.removeAttribute("style"); } function calculateMaxHeight(){ let heights = [...depthMenus].map((item) => item.getBoundingClientRect().height); let maxHeight = Math.max.apply(null, heights); return maxHeight; } function changeMenuHeight(height) { depthMenus.forEach(item => { item.style.height = `${height}px`; }); } } // Mobile function initMobileGnb(mobileGnb){ let html = document.querySelector('html'); let sidebarButton = mobileGnb.querySelector('.sidebar-btn'); let mobileMenuButtons = mobileGnb.querySelectorAll('.depth-1 a'); sidebarButton.addEventListener('click', (event) => { if (mobileGnb.classList.contains('open')) { mobileGnbClose(mobileGnb); } else { mobileGnbOpen(mobileGnb); } }); mobileMenuButtons.forEach(button => { button.addEventListener('click', (event) => { const button = event.target.closest('.depth-1-link'); if (!button) return; if (siblings(button).length > 0) event.preventDefault(); openAccordion(button); }); }) window.addEventListener('resize', function(){ if (window.innerWidth > 1200) { mobileGnbClose(mobileGnb); } }); function mobileGnbOpen(gnb){ gnb.classList.add('open'); html.classList.add('not-scroll'); } function mobileGnbClose(gnb){ gnb.classList.remove('open'); html.classList.remove('not-scroll'); } // ¸ð¹ÙÀÏ ¸Þ´º ¾ÆÄÚµð¾ð function openAccordion($this) { console.log($this); let target = $this.parentElement; let depthTarget = $this.nextElementSibling; if (!depthTarget) return; let otherLinks = siblings(target); let otherItems = otherLinks.map(link => link.querySelector('ul')); if (target.classList.contains('open')){ target.classList.remove('open'); depthTarget.style.maxHeight = '0px'; } else { otherLinks.forEach(link => link.classList.remove('open')); otherItems.forEach(item => item ? item.style.maxHeight = '0px' : ''); target.classList.add('open'); depthTarget.style.maxHeight = depthTarget.scrollHeight + 'px'; } } } function siblings(element) { return [...element.parentElement.children].filter(value => value != element); } /* Every single line of code is pure JavaScript. I've provided comments for some important parts of the code Happy Programming... */ // utlity function qs(elem) { return document.querySelector(elem); } function qsa(elem) { return document.querySelectorAll(elem); } // globals var activeCon = 0, totalCons = 0; // elements const v_cons = qsa(".video-con"), a_cons = qsa(".active-con"), v_count = qs("#video-count"), info_btns = qsa("#lower-info div"), drop_icon = qs("#drop-icon"), video_list = qs("#v-list"), display = qs("#display-frame"); // activate container function activate(con) { deactivateAll(); indexAll(); countVideos(con.querySelector(".index").innerHTML); con.classList.add("active-con"); con.querySelector(".index").innerHTML = "?"; } // deactivate all container function deactivateAll() { v_cons.forEach((container) => { container.classList.remove("active-con"); }); } // index containers function indexAll() { var i = 1; v_cons.forEach((container) => { container.querySelector(".index").innerHTML = i; i++; }); } // update video count function countVideos(active) { v_count.innerHTML = active + " / " + v_cons.length; } // icon activate function toggle_icon(btn) { if (btn.classList.contains("icon-active")) { btn.classList.remove("icon-active"); } else btn.classList.add("icon-active"); } // toggle video list function toggle_list() { if (video_list.classList.contains("li-collapsed")) { drop_icon.style.transform = "rotate(0deg)"; video_list.classList.remove("li-collapsed"); } else { drop_icon.style.transform = "rotate(180deg)"; video_list.classList.add("li-collapsed"); } } function loadVideo(url) { display.setAttribute("src", url); } //****************** // Main Function heres //****************** window.addEventListener("load", function () { // starting calls indexAll(); // container indexes countVideos(1); activate(v_cons[0]); loadVideo(v_cons[0].getAttribute("video")); // Event handeling goes here // on each video container click v_cons.forEach((container) => { container.addEventListener("click", () => { activate(container); loadVideo(container.getAttribute("video")); }); }); // on each button click info_btns.forEach((button) => { button.addEventListener("click", () => { toggle_icon(button); }); }); // drop icon click drop_icon.addEventListener("click", () => { toggle_list(); }); });