$(document).ready(function () { // $(".menu1").click(function (event) { // event.preventDefault(); // $('html,body').animate({ // scrollTop: 420 // }, 500); // }); // $(".menu2").click(function (event) { // event.preventDefault(); // $('html,body').animate({ // scrollTop: 550 // }, 500); // }); //스크롤 이벤트 모바일에서 안됨 // $("nav > ul > li > a").click(function (event) { // event.preventDefault(); // $('html,body').animate({ // scrollTop: $(this.hash).offset().top - $("#header").outerHeight() // }, 500); // }); $(".menu1").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:700, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() <= 640) { window.scrollTo({top:540, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:455, behavior:'smooth'}); } else { window.scrollTo({top:420, behavior:'smooth'}); } }); $(".menu2").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:1462, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() < 640) { window.scrollTo({top:1100, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:950, behavior:'smooth'}); } else { window.scrollTo({top:880, behavior:'smooth'}); } }); $(".menu3").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:2382, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() < 640) { window.scrollTo({top:1800, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:1570, behavior:'smooth'}); } else { window.scrollTo({top:1430, behavior:'smooth'}); } }); $(".menu4").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:3450, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() < 640) { window.scrollTo({top:2590, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:2250, behavior:'smooth'}); } else { window.scrollTo({top:2060, behavior:'smooth'}); } }); $(".menu5").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:4590, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() < 640) { window.scrollTo({top:3450, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:2970, behavior:'smooth'}); } else { window.scrollTo({top:2750, behavior:'smooth'}); } }); $(".menu6").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:5830, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() < 640) { window.scrollTo({top:4380, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:3770, behavior:'smooth'}); } else { window.scrollTo({top:3470, behavior:'smooth'}); } }); $(".menu8").click(function (event) { event.preventDefault(); if ($(window).width() > 640) { window.scrollTo({top:7862, behavior:'smooth'}); } else if ($(window).width() >= 480 && $(window).width() < 640) { window.scrollTo({top:5900, behavior:'smooth'}); } else if ($(window).width() >= 414 && $(window).width() < 480) { window.scrollTo({top:5070, behavior:'smooth'}); } else { window.scrollTo({top:4670, behavior:'smooth'}); } }); $('#back-top, .logo').click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); }); function setPage(arg) { //navigation hn:1depth, sn:2depth, cn:3depth 를 받음 page = jQuery.extend({ hn: "", sn: "", cn: "" }, arg || {}); if (window.console) { console.log("hn : " + page.hn + "\nsn : " + page.sn + "\ncn : " + page.cn); } if (page.hn != 10) { $("#gnb > ul > li.hn" + page.hn + " a").addClass("on"); //1depth 활성 } if (page.hn >= 11) { $("#gnb > ul > li.hn" + page.hn + " a").addClass("on"); //유틸 1depth 활성 } $(".snb ul li.sn" + page.sn).find(" a").addClass("on").end().find("> ul").addClass("on").find("> li.cn" + page.cn + " a").addClass("on"); //2depth 활성 }