/* ---------- js ---------- */ jQuery(function($) { /* 모바일 메뉴 열기 */ function mNav_open() { $(".btn-nav").addClass("mNav_open"); $("#header .navWrap").addClass("mNav_open"); $(".gnbMenuBg").fadeIn(); } function mNav_close() { $(".btn-nav").removeClass("mNav_open"); $("#header .navWrap").removeClass("mNav_open"); $(".gnbMenuBg").fadeOut(); } $(".btn-nav").click(function() { if (!$(this).hasClass("mNav_open")) { mNav_open(); } else { mNav_close(); } }); $(".gnbMenuBg,.mobile-header-close,.navWrap .gnb > li > a,.header-go-to-top").click(function() { mNav_close(); }); $(window).resize(function() { if ($(window).width() > 991) { mNav_close(); }; }); $(window).scroll(function() { if ($(this).scrollTop() > 150) $('.go-to-top').fadeIn('slow'); else $('.go-to-top').fadeOut('slow'); }); $('.header-go-to-top').click(function() { $("html, body").animate({ scrollTop: 0 }, 500); return false; }); $('.go-to-top').click(function() { $("html, body").animate({ scrollTop: 0 }, 500); return false; }); }); $(document).ready(function() { $('#main-menu li > a').on('click', function(e) { e.preventDefault(); if ($(window).width() > 991) { $('html, body').stop().animate({ scrollTop: $(this.hash).offset().top }, 500); } else { $('html, body').stop().animate({ scrollTop: $(this.hash).offset().top - $('#header').outerHeight() }, 500); } }); function mainFullpage() { var headerBg = ['', 'sticky', 'sticky']; $('#mainContainer').fullpage({ responsiveWidth: 992, responsiveHeight: 800, scrollBar:true, onLeave: function(index, nextIndex, direction) { aslideActive(nextIndex - 1); } }); function aslideActive(index) { if (headerBg[index] == '') { $('#header').removeClass('sticky'); } else { $('#header').addClass('sticky'); } } } mainFullpage(); });