$(function(){ $("#nav > ul > li").mouseenter(function(){ $(this).find(".submenu").addClass('on') }) $("#nav > ul > li").mouseleave(function(){ $(this).find(".submenu").removeClass('on') }) $(".mob-btn").click(function(){ $(this).addClass("active"); $("#gnb-mobile").addClass("open"); $(".overlay").show(); }) $("#mobile-nav > li").click(function(){ $(this).find('.submenu').stop().slideToggle(); $(this).toggleClass('open'); }) $(".overlay").click(function(){ $("#gnb-mobile").removeClass("open") $(".overlay").hide(); }) /* $("#nav").find('i').click(function(){ $(this).find(".submenu").removeClass('on') if($(this).parents('li').hasClass('open')){ $(this).parents('li').removeClass('open') $(this).parents("li").find(".submenu").removeClass('on'); }else{ $(this).parents('li').addClass('open'); $(this).parents('li').find(".submenu").addClass('on') } }) */ $(window).load(function() { var doc_h = $(document).height(); var win_w = $(window).width(); var st = $(window).scrollTop(); if (st > 0) { $("#header").addClass("header_scroll"); } else { $("#header").removeClass("header_scroll"); } $(window).scroll(function() { var st = $(window).scrollTop(); if (st > 0) { $("header").addClass("header_scroll"); } else { $("header").removeClass("header_scroll"); } }); }); var url = window.location.pathname; $(".side-menu-list").find('li').each(function(){ var currentUrl = $(this).find('a').attr('href'); if(url == currentUrl){ $(this).addClass('current'); } }) })