{"id":857,"date":"2026-06-26T13:39:03","date_gmt":"2026-06-26T13:39:03","guid":{"rendered":"https:\/\/aabbee.cafe24.com\/?p=857"},"modified":"2026-06-26T13:39:03","modified_gmt":"2026-06-26T13:39:03","slug":"activemenu","status":"publish","type":"post","link":"https:\/\/coalacoding.com\/?p=857","title":{"rendered":"activeMenu"},"content":{"rendered":"<h2>1. \uba54\ub274\ud65c\uc131\ud654<\/h2>\n<h3>1.1. \ub2e8\uacc41-\uc0c1\ub2e8\uba54\ub274<\/h3>\n<h4>1.1.1. \uc2a4\ud2f0\ud0a4<\/h4>\n<h4>\uc608\uc81c<\/h4>\n<pre><code>[\ubbf8\ub9ac\ubcf4\uae30](https:\/\/qwerewqwerew.github.io\/source\/jq\/9)\n<\/code><\/pre>\n<h4>HTML<\/h4>\n<pre><code class=\"language-html\">  &lt;!DOCTYPE html&gt;\n  &lt;html lang=&quot;ko&quot;&gt;\n    &lt;head&gt;\n      &lt;meta charset=&quot;UTF-8&quot; \/&gt;\n      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot; \/&gt;\n      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; \/&gt;\n      &lt;title&gt;Document&lt;\/title&gt;\n      &lt;meta property=&quot;og:title&quot; content=&quot;\ubc1c\uc804\ud558\ub294 \uc2e0\uc785 \ud37c\ube14\ub9ac\uc154 \ub9dd\uace0\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624\uc785\ub2c8\ub2e4&quot; \/&gt;\n      &lt;meta property=&quot;og:url&quot; content=&quot;http:\/\/www.mango.dothome.co.kr&quot; \/&gt;\n      &lt;meta property=&quot;og:type&quot; content=&quot;website&quot; \/&gt;\n      \n      &lt;meta property=&quot;og:site_name&quot; content=&quot;\ub9dd\uace0\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624&quot; \/&gt;\n      &lt;meta property=&quot;og:description&quot; content=&quot;\uc624\ub298\ubcf4\ub2e4\ub294 \ub0b4\uc77c \ub354 \uc131\uc7a5\ud558\ub294 \uac83\uc774 \ubaa9\ud45c\uc778 \ud37c\ube14\ub9ac\uc154\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624\uc785\ub2c8\ub2e4.&quot; \/&gt;\n      &lt;meta name=&quot;twitter:card&quot; content=&quot;summary&quot; \/&gt;\n      &lt;meta name=&quot;twitter:title&quot; content=&quot;\ubc1c\uc804\ud558\ub294 \uc2e0\uc785 \ud37c\ube14\ub9ac\uc154 \ub9dd\uace0\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624\uc785\ub2c8\ub2e4&quot; \/&gt;\n      &lt;meta name=&quot;twitter:description&quot; content=&quot;\uc624\ub298\ubcf4\ub2e4\ub294 \ub0b4\uc77c \ub354 \uc131\uc7a5\ud558\ub294 \uac83\uc774 \ubaa9\ud45c\uc778 \ud37c\ube14\ub9ac\uc154\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624\uc785\ub2c8\ub2e4.&quot; \/&gt;\n      \n      &lt;link rel=&quot;stylesheet&quot; href=&quot;css\/reset.css&quot; \/&gt;\n      &lt;link rel=&quot;stylesheet&quot; href=&quot;css\/style.css&quot; \/&gt;\n    &lt;\/head&gt;\n\n    &lt;body&gt;\n      &lt;nav&gt;\n        &lt;ul class=&quot;gnb&quot;&gt;\n          &lt;li class=&quot;on&quot;&gt;&lt;a href=&quot;#section1&quot;&gt;section1&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section2&quot;&gt;section2&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section3&quot;&gt;section3&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section4&quot;&gt;section4&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section5&quot;&gt;section5&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section6&quot;&gt;section6&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section7&quot;&gt;section7&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section8&quot;&gt;section8&lt;\/a&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;a href=&quot;#section9&quot;&gt;section9&lt;\/a&gt;&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/nav&gt;\n      &lt;ul class=&quot;sideNav&quot;&gt;\n        &lt;li class=&quot;on&quot;&gt;&lt;a href=&quot;#section1&quot;&gt;section1&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section2&quot;&gt;section2&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section3&quot;&gt;section3&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section4&quot;&gt;section4&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section5&quot;&gt;section5&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section6&quot;&gt;section6&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section7&quot;&gt;section7&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section8&quot;&gt;section8&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li&gt;&lt;a href=&quot;#section9&quot;&gt;section9&lt;\/a&gt;&lt;\/li&gt;\n      &lt;\/ul&gt;\n      &lt;main class=&quot;container&quot;&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section1&quot;&gt;section1&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section2&quot;&gt;section2&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section3&quot;&gt;\n          &lt;div class=&quot;ball&quot;&gt;ball&lt;\/div&gt;\n          section3\n        &lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section4&quot;&gt;section4&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section5&quot;&gt;section5&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section6&quot;&gt;section6&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section7&quot;&gt;section7&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section8&quot;&gt;section8&lt;\/section&gt;\n        &lt;section class=&quot;section&quot; id=&quot;section9&quot;&gt;section9&lt;\/section&gt;\n      &lt;\/main&gt;\n      &lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.12.0.js&quot;&gt;&lt;\/script&gt;\n      &lt;script src=&quot;https:\/\/code.jquery.com\/ui\/1.12.0\/jquery-ui.js&quot;&gt;&lt;\/script&gt;\n      &lt;script src=&quot;jq.js&quot;&gt;&lt;\/script&gt;\n    &lt;\/body&gt;\n  &lt;\/html&gt;\n<\/code><\/pre>\n<h4>CSS<\/h4>\n<pre><code>[reset\ub2e4\uc6b4\ub85c\ub4dc](https:\/\/meyerweb.com\/eric\/tools\/css\/reset\/)\n\n```css\n  @charset &#39;UTF-8&#39;;\n  @import url(&#39;https:\/\/fonts.googleapis.com\/css2?family=Black+And+White+Picture&amp;family=Noto+Sans+KR:wght@100; 300; 400; 500; 700; 900&amp;display=swap&#39;);\n  html {\n    overflow-x: hidden;\n  }\n  html,\n  body,\n  a,\n  table {\n    font-family: &#39;Black And White Picture&#39;, sans-serif;\n    font-family: &#39;Noto Sans KR&#39;, sans-serif;\n  }\n  ul,\n  li,\n  ol {\n    list-style: none;\n  }\n  a {\n    text-decoration: none;\n  }\n\n  body::-webkit-scrollbar {\n    width: 1em;\n    background-color: red;\n    background-image: repeating-conic-gradient(#474bff 0% 25%, #47d3ff 0% 50%);\n    background-position: 0 0, 38px 38px;\n    background-size: 46px 76px;\n    background-color: #47d3ff;\n  }\n  body::-webkit-scrollbar-thumb {\n  }\n  body::-webkit-scrollbar-button {\n    width: 3em;\n    height: 3em;\n    background-color: #282972;\n    box-shadow: 1px 1px 3px #000;\n  }\n  body::-webkit-scrollbar-thumb {\n    width: 10em;\n    height: 10em;\n    background-color: #47d3ff;\n    background-image: linear-gradient(to right top, #d16ba5, #c777b9, #ba83ca, #aa8fd8, #9a9ae1, #8aa7ec, #79b3f4, #69bff8, #52cffe, #41dfff, #46eefa, #5ffbf1);\n    border-radius: 3px 0 0 3px;\n    box-shadow: 1px 1px 4px #000;\n  }\n  \/* nav *\/\n  nav {\n    position: absolute;\n    top: 0;\n    z-index: 2;\n    background: rgba(0, 0, 0, 0.4);\n    padding: 1em 1.4em;\n    width: 100%;\n  }\n  nav.sticky {\n    background: rgba(255, 0, 100, 0.6);\n    position: fixed;\n    z-index: 222;\n  }\n  nav .gnb {\n    display: flex;\n    width: 100%;\n    max-width: 1600px;\n    margin: auto;\n  }\n  nav .gnb li {\n    flex: 1 1 200px;\n  }\n  nav .gnb li a {\n    color: #fff;\n    display: inline-block;\n    padding: 0.2rem;\n    text-align: center;\n    line-height: 2rem;\n    height: 2rem;\n    position: relative;\n  }\n  nav .gnb li a:before,\n  nav .gnb li a:after {\n    position: absolute;\n    content: &#39;&#39;;\n    left: 0;\n    width: 100%;\n    height: 2px;\n    background: #000;\n    transform: scaleX(0);\n    transition: all 0.5s;\n  }\n  nav .gnb li a:before {\n    top: 0;\n    transform-origin: left;\n  }\n  .gnb li a:after {\n    bottom: 0;\n    transform-origin: right;\n  }\n  nav .gnb li.on a:before,\n  nav .gnb li a:hover:before,\n  nav .gnb li.on a:after,\n  nav .gnb li a:hover:after {\n    transform: scaleX(1);\n  }\n  .container {\n  }\n  section {\n    min-height: 100vh;\n    line-height: 100vh;\n    text-align: center;\n    background-color: yellow;\n    margin: 40vw auto;\n  }\n  section::selection {\n    color: red;\n    background-color: #00eeff;\n  }\n\n  \/* sideNav  *\/\n  .sideNav {\n    position: fixed;\n    top: 10%;\n    right: 10%;\n    z-index: 999;\n  }\n  .sideNav a {\n    display: inline-block;\n    padding: 1em;\n    background: rgba(0, 0, 0, 0.5);\n    color: #fff;\n    margin-bottom: 1em;\n  }\n  .sideNav li.on a::before {\n    content: &#39;\ud83d\ude3a&#39;;\n  }\n\n  \/* sectionIn *\/\n  section {\n    position: relative;\n  }\n  section .ball {\n    position: absolute;\n    background-color: skyblue;\n    width: 450px;\n    height: 450px;\n    border-radius: 50%;\n    left: -450px;\n    transition: left 1s;\n  }\n  section.on .ball {\n    left: 100px;\n  }\n```\n<\/code><\/pre>\n<h4>JQ<\/h4>\n<pre><code>```js\n  let win = $(window),\n    sections = $(&#39;.section&#39;),\n    gnb = $(&#39;.gnb li&#39;),\n    sideNav = $(&#39;.sideNav&gt;li&#39;);\n\n  const gnbOff = () =&gt; {\n    gnb.each(() =&gt; {\n      this.removeClass(&#39;on&#39;);\n    });\n  };\n\n  gnb.click(function (e) {\n    e.preventDefault();\n    let tg = $(this);\n    let index = tg.index();\n    let section = sections.eq(index);\n    let offset = section.offset().top;\n    $(&#39;html,body&#39;).stop().animate({ scrollTop: offset }, 1000, &#39;easeOutCirc&#39;);\n  });\n  sideNav.click(function (e) {\n    e.preventDefault();\n    let tg = $(this);\n    let index = tg.index();\n    let section = sections.eq(index);\n    let offset = section.offset().top;\n    $(&#39;html,body&#39;).stop().animate({ scrollTop: offset }, 1000, &#39;easeOutCirc&#39;);\n  });\n\n  win.scroll(function () {\n    let sct = win.scrollTop();\n    sections.each(function (i) {\n      if (sct &gt;= sections.eq(i).offset().top - 300) {\n        $(&#39;.gnb li&#39;).eq(i).addClass(&#39;on&#39;).siblings().removeClass(&#39;on&#39;);\n        sideNav.eq(i).addClass(&#39;on&#39;).siblings().removeClass(&#39;on&#39;);\n        sections.eq(i).addClass(&#39;on&#39;).siblings().removeClass(&#39;on&#39;);\n      }\n    });\n    sct &gt; 400 ? $(&#39;nav&#39;).addClass(&#39;sticky&#39;) : $(&#39;nav&#39;).removeClass(&#39;sticky&#39;);\n  });\n```\n<\/code><\/pre>\n<h4>JS<\/h4>\n<pre><code>```js\nlet win = window,\n  winSct,\n  sections = document.querySelectorAll(&#39;.section&#39;),\n  gnb = document.querySelectorAll(&#39;.gnb li&#39;),\n  sideNav = document.querySelectorAll(&#39;.sideNav&gt;li&#39;);\n\nconst gnbOff = () =&gt; {\n  gnb.forEach((o) =&gt; {\n    o.classList.remove(&#39;on&#39;);\n  });\n};\nconst navOff = () =&gt; {\n  sideNav.forEach((o) =&gt; {\n    o.classList.remove(&#39;on&#39;);\n  });\n};\n\ngnb.forEach((el) =&gt; {\n  el.addEventListener(&#39;click&#39;, function (e) {\n    e.preventDefault();\n    document.querySelector(el.firstChild.getAttribute(&#39;href&#39;)).scrollIntoView({ behavior: &#39;smooth&#39; });\n    gnbOff();\n    el.classList.add(&#39;on&#39;);\n  });\n});\nsideNav.forEach((el) =&gt; {\n  el.addEventListener(&#39;click&#39;, function (e) {\n    e.preventDefault();\n    document.querySelector(el.firstChild.getAttribute(&#39;href&#39;)).scrollIntoView({ behavior: &#39;smooth&#39; });\n    navOff();\n    el.classList.add(&#39;on&#39;);\n  });\n});\n\nwin.addEventListener(&#39;scroll&#39;, function (e) {\n  e.preventDefault();\n  winSct = this.scrollY;\n  winSct &gt;= 400 ? document.querySelector(&#39;nav&#39;).classList.add(&#39;sticky&#39;) : document.querySelector(&#39;nav&#39;).classList.remove(&#39;sticky&#39;);\n  scrollOn(winSct);\n});\n\nconst scrollOn = (sct) =&gt; {\n  if (sct &gt;= sections[0].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(1)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(1)&#39;).classList.add(&#39;on&#39;);\n    sections[0].classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[1].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(2)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(2)&#39;).classList.add(&#39;on&#39;);\n    sections[1].classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[2].offsetTop - 700) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(3)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(3)&#39;).classList.add(&#39;on&#39;);\n    sections[2].classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[3].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(4)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(4)&#39;).classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[4].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(5)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(5)&#39;).classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[5].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(6)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(6)&#39;).classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[6].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(7)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(7)&#39;).classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[7].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(8)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(8)&#39;).classList.add(&#39;on&#39;);\n  }\n  if (sct &gt;= sections[8].offsetTop - 300) {\n    gnbOff();\n    navOff();\n    document.querySelector(&#39;.gnb li:nth-child(9)&#39;).classList.add(&#39;on&#39;);\n    document.querySelector(&#39;.sideNav li:nth-child(2)&#39;).classList.add(&#39;on&#39;);\n  }\n};\n<\/code><\/pre>\n<pre><code>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. \uba54\ub274\ud65c\uc131\ud654 1.1. \ub2e8\uacc41-\uc0c1\ub2e8\uba54\ub274 1.1.1. \uc2a4\ud2f0\ud0a4 \uc608\uc81c [\ubbf8\ub9ac\ubcf4\uae30](https:\/\/qwerewqwerew.github.io\/source\/jq\/9) HTML &lt;!DOCTYPE html&gt; &lt;html lang=&quot;ko&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot; \/&gt; &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot; \/&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; \/&gt; &lt;title&gt;Document&lt;\/title&gt; &lt;meta property=&quot;og:title&quot; content=&quot;\ubc1c\uc804\ud558\ub294 \uc2e0\uc785 \ud37c\ube14\ub9ac\uc154 \ub9dd\uace0\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624\uc785\ub2c8\ub2e4&quot; \/&gt; &lt;meta property=&quot;og:url&quot; content=&quot;http:\/\/www.mango.dothome.co.kr&quot; \/&gt; &lt;meta property=&quot;og:type&quot; content=&quot;website&quot; \/&gt; &lt;meta property=&quot;og:site_name&quot; content=&quot;\ub9dd\uace0\uc758 \ud3ec\ud2b8\ud3f4\ub9ac\uc624&quot; \/&gt; &lt;meta property=&quot;og:description&quot; content=&quot;\uc624\ub298\ubcf4\ub2e4\ub294 \ub0b4\uc77c \ub354 \uc131\uc7a5\ud558\ub294 \uac83\uc774 &#8230; <a title=\"activeMenu\" class=\"read-more\" href=\"https:\/\/coalacoding.com\/?p=857\" aria-label=\"activeMenu\uc5d0 \ub300\ud574 \ub354 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uc138\uc694\">\ub354 \uc77d\uae30<\/a><\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-857","post","type-post","status-publish","format-standard","hentry","category-html-css-ui"],"_links":{"self":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/posts\/857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=857"}],"version-history":[{"count":0,"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/posts\/857\/revisions"}],"wp:attachment":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}