$(function() { var windoww = $(window).width(); if (windoww >= 1200) { $(".nav ul li").hover(function() { $(this).find(".sec_nav").fadetoggle(); }) } $('.nav_icon').click(function() { if ($(this).hasclass('on')) { $(this).removeclass('on'); $('.m_naver').slideup(); } else { $(this).addclass('on'); $('.m_naver').slidedown(); } }) $('.m_naver ul li').each(function() { if ($(this).find('dl').length) { $(this).children('a').addclass('icon1'); $(this).children('a').removeattr('href'); }; }) $('.m_naver ul li > a').on('click', function() { if ($(this).hasclass('active')) { $(this).removeclass('active'); $(this).next().slideup(); } else { $(this).addclass('active'); $(this).next().slidedown().parents('li').siblings().find('dl').slideup(); $(this).parent('li').siblings().children('a').removeclass('active'); }; }) $(window).scroll(function(){ if($(window).scrolltop() > 100) { $(".header").css("background","rgba(255,255,255,1)") }else { $(".header").css("background","rgba(255,255,255,.8)") } }) }) $(document).on('click', '.sec_nav dl dd a', function(event){ $('html, body').animate({ scrolltop: $( $.attr(this, 'href') ).offset().top }, 800); });