½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
GSAP ÅÇ ÄÜÅÙÃ÷ ¾Ö´Ï¸ÞÀ̼Ç(Tab content toggle) : happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > CSS > ±âº» ¼Ò½º > GSAP ÅÇ ÄÜÅÙÃ÷ ¾Ö´Ï¸ÞÀ̼Ç(Tab content toggle) »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
javascript
HTML
PHP
Api
2022
ASP
CSS
mysql
Slide
jquery
¸ðµâ
°¶·¯¸®
À¥¸ÞÀÏ
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
GSAP ÅÇ ÄÜÅÙÃ÷ ¾Ö´Ï¸ÞÀ̼Ç(Tab content toggle)
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù ±âº» ¼Ò½º
´Ù¿î·Îµå Ƚ¼ö 10 ȸ
°£´Ü¼³¸í GSAP°ú SplitText¸¦ Ȱ¿ëÇØ ÅÇ ÄÜÅÙÃ÷°¡ ºÎµå·´°Ô ÀüȯµÇ´Â ÀÎÅÍ·¢¼Ç ¿¹Á¦ÀÔ´Ï´Ù. ÅÇ Å¬¸¯ ½Ã ¹®ÀåÀÌ ÁÙ ´ÜÀ§·Î ¿òÁ÷À̸ç ÀÚ¿¬½º·´°Ô ±³Ã¼µÇ´Â È¿°ú¸¦ È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
ȨÆäÀÌÁö¹Ù·Î°¡±â ¼Ò½º´Ù¿î·Îµå µ¥¸ð ¹Ì¸®º¸±â ½ºÅ©·¦Çϱâ

ÅÇÀ» Ŭ¸¯ÇÏ¸é ¼±ÅÃÇÑ ÄÜÅÙÃ÷°¡ ºÎµå·´°Ô ÀüȯµÇ´Â UI ¿¹Á¦ÀÔ´Ï´Ù.

SplitText¸¦ »ç¿ëÇØ ÅØ½ºÆ®¸¦ ÁÙ ´ÜÀ§·Î ³ª´©°í, GSAP ¾Ö´Ï¸ÞÀ̼ÇÀ¸·Î ÀÚ¿¬½º·´°Ô µîÀå½Ãŵ´Ï´Ù.
´Ü¼øÇÑ ÅÇ ¸Þ´ºº¸´Ù ½Ã°¢ÀûÀÎ È¿°ú°¡ ÁÁ¾Æ ·£µùÆäÀÌÁö³ª ¼Ò°³ ¼½¼Ç¿¡ Ȱ¿ëÇϱâ ÁÁ½À´Ï´Ù.
ÅØ½ºÆ® Áß½ÉÀÇ ÄÜÅÙÃ÷ Àüȯ È¿°ú¸¦ ±¸ÇöÇÒ ¶§ Âü°íÇϱâ ÁÁÀº ÀÚ·áÀÔ´Ï´Ù.

HTML ±¸Á¶

<div class="tabs-demo">

  <div class="tabs" id="tabs"></div>

  <div class="content-wrapper" id="contentWrapper"></div>

</div>



CSS ¼Ò½º

* {

  box-sizing: border-box;

}


body {

  margin: 0;

  min-height: 100vh;

  display: grid;

  place-items: center;

  background: #f4f4f0;

  font-family: Inter, sans-serif;

  font-size: 16px;

}


.tabs-demo {

  width: 100%;

  max-width: 1020px;

  padding: 0 clamp(2rem, 8vw, 5rem);

}


.tabs {

  display: flex;

  justify-content: center;

  gap: 12px;

  margin-bottom: 32px;

  flex-wrap: wrap;

}


.tab {

  border: none;

  padding: 10px 16px;

  border-radius: 999px;

  font-size: 16px;

  font-weight: 500;

  letter-spacing: 0.02em;

  color: #000;

  cursor: pointer;

  background: rgba(0,0,0,0.08);

  transition: all 0.25s cubic-bezier(0.256, 0.009, 0.125, 0.997);

}


.tab&:hover {

  background: rgba(0,0,0,0.16);

}


.tab.active {

  background: #111;

  color: #fff;

}


.content-wrapper {

  position: relative;

  display: grid;

  grid-template-columns: 1fr;

}


.role-content {

  grid-column: 1;

  grid-row: 1;

  text-align: center;

  font-size: clamp(2rem, 3vw, 3rem);

  font-weight: 600;

  line-height: 1.15;

  letter-spacing: -0.03em;

  color: #000;

}


/* SplitText mask */

.himaaax-split-line {

  overflow: hidden;

  display: block;

}


JS ¼Ò½º

 gsap.registerPlugin(SplitText);

 

const TAB_CONTENT = [

  {

    id: "teams",

    label: "Teams",

    text: "Work that moves at the speed of trust. Shared language, aligned direction, and a process that makes collaboration feel genuinely effortless."

  },

  {

    id: "founders",

    label: "Founders",

    text: "Turn early conviction into something people actually want. From rough idea to refined product — without losing what made it compelling."

  },

  {

    id: "designers",

    label: "Designers",

    text: "Craft interfaces that speak before a single word is read. Visual systems built to carry meaning across every touchpoint of a product."

  },

  {

    id: "engineers",

    label: "Engineers",

    text: "Build with precision on a foundation that scales. Architecture decisions that outlast the brief and hold up under real-world pressure."

  }

];

 

const DURATION = 0.4;

const STAGGER = 0.06;

const OVERLAP = "<0.24";

const Y_OFFSET = 150;

 

const tabsEl = document.getElementById("tabs");

const wrapper = document.getElementById("contentWrapper");

 

let activeIndex = 0;

let isAnimating = false;

let queuedIndex = null;

let tl = null;

 

TAB_CONTENT.forEach((item, i) => {

  const btn = document.createElement("button");

  btn.className = "tab" + (i === 0 ? " active" : "");

  btn.textContent = item.label;

  tabsEl.appendChild(btn);

 

  const panel = document.createElement("div");

  panel.className = "role-content";

  panel.textContent = item.text;

  wrapper.appendChild(panel);

});

 

const panels = [...document.querySelectorAll(".role-content")];

 

const splits = panels.map((el, i) => {

  return SplitText.create(el, {

    type: "lines",

    mask: "lines",

    linesClass: "himaaax-split-line",

    autoSplit: true,

    onSplit(self) {

      gsap.set(el, { opacity: 1 });

.......................................

÷ºÎÆÄÀÏÈ®ÀÎ

.......................................

 

document.querySelectorAll(".tab").forEach((btn, i) => {

  btn.addEventListener("click", () => switchTab(i));

});


 

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