½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > CSS > ±âº» ¼Ò½º > Animated Tab Bar - ¾Ö´Ï¸ÞÀÌ¼Ç ÅÇ Ç¥½ÃÁÙ »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
javascript
php
ASP
CSS
html
mysql
jquery
image
API
Mobile
¸Þ´º
Slide
°Ô½ÃÆÇ
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
Animated Tab Bar - ¾Ö´Ï¸ÞÀÌ¼Ç ÅÇ Ç¥½ÃÁÙ
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù ±âº» ¼Ò½º
´Ù¿î·Îµå Ƚ¼ö 123 ȸ
°£´Ü¼³¸í ¿©·¯ÀåÀÇ À̹ÌÁö¸¦ ÇϳªÀÇ ¿òÁ÷ÀÌ´Â GIF·Î ¸¸µå´Â À¥ÆäÀÌÁöÀÔ´Ï´Ù.
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
ȨÆäÀÌÁö¹Ù·Î°¡±â µ¥¸ð ¹Ì¸®º¸±â ½ºÅ©·¦Çϱâ

¾Ö´Ï¸ÞÀÌ¼Ç ÅÇ Ç¥½ÃÁÙÀº ¾Ö´Ï¸ÞÀ̼ǰú ÀüȯÀ» »ç¿ëÇÏ¿© »ç¿ëÀÚ¿¡°Ô ´õ¿í Á÷°üÀûÀÎ ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇØ ÁÙ ¼ö ÀÖ½À´Ï´Ù.
ÅÇÀ» Ŭ¸¯Çϸé ÇØ´ç ÅÇ°ú °ü·ÃµÈ ÄÜÅÙÃ÷°¡ ½¬¿î ¾Ö´Ï¸ÞÀ̼ÇÀ¸·Î Ç¥½ÃÇÏ°Ô µË´Ï´Ù.
¾Ö´Ï¸ÞÀÌ¼Ç ÅÇ Ç¥½ÃÁÙÀº À¥ÆäÀÌÁö Á»´õ ¿ªµ¿ÀûÀÌ°í ¸Å·ÂÀûÀ¸·Î ¸¸µé ¼ö ÀÖ½À´Ï´Ù.

¸ðµç ÅÇ°ú °ü·ÃµÈ ÄÜÅÙÃ÷¸¦ ½¬¿î ¾Ö´Ï¸ÞÀ̼ÇÀ¸·Î º¸¿©ÁÜÀ¸·Î½á ÇöÀç À¥ »çÀÌÆ® ¶Ç´Â ¾ÛÀÇ ¾î´À ºÎºÐ¿¡ ÀÖ´ÂÁö,
´Ù¸¥ ¼½¼ÇÀ¸·Î À̵¿ÇÏ´Â ¹æ¹ýÀ» ½±°Ô ÀÌÇØÇÒ ¼ö ÀÖ°Ô ¸¸µé¾î ÁÖ´Â È¿°ú°¡ ÀÖ½À´Ï´Ù.

HTML ±¸Á¶

<menu class="menu">

    

    <button class="menu__item active" style="--bgColorItem: #ff8c00;" >

      <svg class="icon" viewBox="0 0 24 24">

        <path d="M3.8,6.6h16.4"/>

        <path d="M20.2,12.1H3.8"/>

        <path d="M3.8,17.5h16.4"/>

      </svg>

    </button>


    <button class="menu__item" style="--bgColorItem: #f54888;">

      <svg class="icon" viewBox="0 0 24 24">

        <path  d="M6.7,4.8h10.7c0.3,0,0.6,0.2,0.7,0.5l2.8,7.3c0,0.1,0,0.2,0,0.3v5.6c0,0.4-0.4,0.8-0.8,0.8H3.8

        C3.4,19.3,3,19,3,18.5v-5.6c0-0.1,0-0.2,0.1-0.3L6,5.3C6.1,5,6.4,4.8,6.7,4.8z"/>

        <path  d="M3.4,12.9H8l1.6,2.8h4.9l1.5-2.8h4.6"/>

      </svg>

    </button>


    <button class="menu__item" style="--bgColorItem: #4343f5;" >

      <svg class="icon" viewBox="0 0 24 24">

      <path  d="M3.4,11.9l8.8,4.4l8.4-4.4"/>

      <path  d="M3.4,16.2l8.8,4.5l8.4-4.5"/>

      <path  d="M3.7,7.8l8.6-4.5l8,4.5l-8,4.3L3.7,7.8z"/>

    </button>


    <button class="menu__item" style="--bgColorItem: #e0b115;" > 

      <svg class="icon" viewBox="0 0 24 24" >

        <path  d="M5.1,3.9h13.9c0.6,0,1.2,0.5,1.2,1.2v13.9c0,0.6-0.5,1.2-1.2,1.2H5.1c-0.6,0-1.2-0.5-1.2-1.2V5.1

          C3.9,4.4,4.4,3.9,5.1,3.9z"/>

        <path  d="M4.2,9.3h15.6"/>

        <path  d="M9.1,9.5v10.3"/>

    </button>


    <button class="menu__item" style="--bgColorItem:#65ddb7;">

      <svg class="icon" viewBox="0 0 24 24" >

        <path  d="M5.1,3.9h13.9c0.6,0,1.2,0.5,1.2,1.2v13.9c0,0.6-0.5,1.2-1.2,1.2H5.1c-0.6,0-1.2-0.5-1.2-1.2V5.1

          C3.9,4.4,4.4,3.9,5.1,3.9z"/>

        <path  d="M5.5,20l9.9-9.9l4.7,4.7"/>

        <path  d="M10.4,8.8c0,0.9-0.7,1.6-1.6,1.6c-0.9,0-1.6-0.7-1.6-1.6C7.3,8,8,7.3,8.9,7.3C9.7,7.3,10.4,8,10.4,8.8z"/>

      </svg>

    </button>


    <div class="menu__border"></div>


  </menu>


  <div class="svg-container">

    <svg viewBox="0 0 202.9 45.5" >

      <clipPath id="menu" clipPathUnits="objectBoundingBox" transform="scale(0.0049285362247413 0.021978021978022)">

        <path  d="M6.7,45.5c5.7,0.1,14.1-0.4,23.3-4c5.7-2.3,9.9-5,18.1-10.5c10.7-7.1,11.8-9.2,20.6-14.3c5-2.9,9.2-5.2,15.2-7

          c7.1-2.1,13.3-2.3,17.6-2.1c4.2-0.2,10.5,0.1,17.6,2.1c6.1,1.8,10.2,4.1,15.2,7c8.8,5,9.9,7.1,20.6,14.3c8.3,5.5,12.4,8.2,18.1,10.5

          c9.2,3.6,17.6,4.2,23.3,4H6.7z"/>

      </clipPath>

    </svg>

  </div>



CSS ¼Ò½º

<menu class="menu">

    

    <button class="menu__item active" style="--bgColorItem: #ff8c00;" >

      <svg class="icon" viewBox="0 0 24 24">

        <path d="M3.8,6.6h16.4"/>

        <path d="M20.2,12.1H3.8"/>

        <path d="M3.8,17.5h16.4"/>

      </svg>

    </button>


    <button class="menu__item" style="--bgColorItem: #f54888;">

      <svg class="icon" viewBox="0 0 24 24">

        <path  d="M6.7,4.8h10.7c0.3,0,0.6,0.2,0.7,0.5l2.8,7.3c0,0.1,0,0.2,0,0.3v5.6c0,0.4-0.4,0.8-0.8,0.8H3.8

        C3.4,19.3,3,19,3,18.5v-5.6c0-0.1,0-0.2,0.1-0.3L6,5.3C6.1,5,6.4,4.8,6.7,4.8z"/>

        <path  d="M3.4,12.9H8l1.6,2.8h4.9l1.5-2.8h4.6"/>

      </svg>

    </button>


    <button class="menu__item" style="--bgColorItem: #4343f5;" >

      <svg class="icon" viewBox="0 0 24 24">

      <path  d="M3.4,11.9l8.8,4.4l8.4-4.4"/>

      <path  d="M3.4,16.2l8.8,4.5l8.4-4.5"/>

      <path  d="M3.7,7.8l8.6-4.5l8,4.5l-8,4.3L3.7,7.8z"/>

    </button>


    <button class="menu__item" style="--bgColorItem: #e0b115;" > 

      <svg class="icon" viewBox="0 0 24 24" >

        <path  d="M5.1,3.9h13.9c0.6,0,1.2,0.5,1.2,1.2v13.9c0,0.6-0.5,1.2-1.2,1.2H5.1c-0.6,0-1.2-0.5-1.2-1.2V5.1

          C3.9,4.4,4.4,3.9,5.1,3.9z"/>

        <path  d="M4.2,9.3h15.6"/>

        <path  d="M9.1,9.5v10.3"/>

    </button>


    <button class="menu__item" style="--bgColorItem:#65ddb7;">

      <svg class="icon" viewBox="0 0 24 24" >

        <path  d="M5.1,3.9h13.9c0.6,0,1.2,0.5,1.2,1.2v13.9c0,0.6-0.5,1.2-1.2,1.2H5.1c-0.6,0-1.2-0.5-1.2-1.2V5.1

          C3.9,4.4,4.4,3.9,5.1,3.9z"/>

        <path  d="M5.5,20l9.9-9.9l4.7,4.7"/>

        <path  d="M10.4,8.8c0,0.9-0.7,1.6-1.6,1.6c-0.9,0-1.6-0.7-1.6-1.6C7.3,8,8,7.3,8.9,7.3C9.7,7.3,10.4,8,10.4,8.8z"/>

      </svg>

    </button>


    <div class="menu__border"></div>


  </menu>


  <div class="svg-container">

    <svg viewBox="0 0 202.9 45.5" >

      <clipPath id="menu" clipPathUnits="objectBoundingBox" transform="scale(0.0049285362247413 0.021978021978022)">

        <path  d="M6.7,45.5c5.7,0.1,14.1-0.4,23.3-4c5.7-2.3,9.9-5,18.1-10.5c10.7-7.1,11.8-9.2,20.6-14.3c5-2.9,9.2-5.2,15.2-7

          c7.1-2.1,13.3-2.3,17.6-2.1c4.2-0.2,10.5,0.1,17.6,2.1c6.1,1.8,10.2,4.1,15.2,7c8.8,5,9.9,7.1,20.6,14.3c8.3,5.5,12.4,8.2,18.1,10.5

          c9.2,3.6,17.6,4.2,23.3,4H6.7z"/>

      </clipPath>

    </svg>

  </div>



JS ¼Ò½º

// Designed by:  Mauricio Bucardo

// Original image:

// https://dribbble.com/shots/5619509-Animated-Tab-Bar


"use strict"; 


const body = document.body;

const bgColorsBody = ["#ffb457", "#ff96bd", "#9999fb", "#ffe797", "#cffff1"];

const menu = body.querySelector(".menu");

const menuItems = menu.querySelectorAll(".menu__item");

const menuBorder = menu.querySelector(".menu__border");

let activeItem = menu.querySelector(".active");


function clickItem(item, index) {


    menu.style.removeProperty("--timeOut");

    

    if (activeItem == item) return;

    

    if (activeItem) {

        activeItem.classList.remove("active");

    }


    

    item.classList.add("active");

    body.style.backgroundColor = bgColorsBody[index];

    activeItem = item;

    offsetMenuBorder(activeItem, menuBorder);

    

    

}


function offsetMenuBorder(element, menuBorder) {


    const offsetActiveItem = element.getBoundingClientRect();

    const left = Math.floor(offsetActiveItem.left - menu.offsetLeft - (menuBorder.offsetWidth  - offsetActiveItem.width) / 2) +  "px";

    menuBorder.style.transform = `translate3d(${left}, 0 , 0)`;


}


offsetMenuBorder(activeItem, menuBorder);


menuItems.forEach((item, index) => {


    item.addEventListener("click", () => clickItem(item, index));

    

})


window.addEventListener("resize", () => {

    offsetMenuBorder(activeItem, menuBorder);

    menu.style.setProperty("--timeOut", "none");

});


 

³×ƼÁð ÀÇ°ß   ÀÌ¿ëÇϽŠÀÚ·áÀÇ Èı⸦ ÀÚÀ¯·Ó°Ô ÀÛ¼ºÇϼ¼¿ä. (»ó¾÷ÀûÀÎ ±¤°í ¹× µµ¹è¼º ±Û µîÀº »çÀüÅ뺸¾øÀÌ »èÁ¦µÉ ¼ö ÀÖ½À´Ï´Ù.)
³»¿ë ¾ÆÀ̵ð ÀÇ°ß³²±â±â
µî·ÏµÈ ÀÇ°ßÀÌ ¾ø½À´Ï´Ù.
1
À̸§
³»¿ë
:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
µµ¹è¹æÁöÅ°
 11121952 º¸ÀÌ´Â µµ¹è¹æÁöÅ°¸¦ ÀÔ·ÂÇϼ¼¿ä.