user-img

css ๋””์ž์ธ์€ ํ•˜๊ณ ์‹œํ”ˆ๋Œ€๋กœ ~,~

 

See the Pen Untitled by 123 (@123-the-scripter) on CodePen.

 

html ํ†ตํ•ฉ ์ฝ”๋“œ 

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Toggle Button</title>
  <style>
    .nyang-toggle-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 50px;
    }

    .nyang-toggle-button {
      position: relative;
      width: 50px;
      height: 30px;
      border-radius: 30px; /* ์–‘ ๋์ด ๋‘ฅ๊ธ€๊ฒŒ ์ฒ˜๋ฆฌ๋œ ์‚ฌ๊ฐํ˜• */
      background: #ccc;
      cursor: pointer;
      transition: background 0.3s ease;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* ์™ธ๋ถ€ ๊ทธ๋ฆผ์ž */
    }

    .nyang-toggle-heart {
      position: absolute;
      top: 50%;
      left: 5px;
      transform: translateY(-50%);
      font-size: 22px;
      color: #fff; /* ํ•˜์–€์ƒ‰ ํ•˜ํŠธ */
      transition: left 0.3s ease;
    }

    .nyang-toggle-button.active {
      background: #f385af;
    }

    .nyang-toggle-button.active .nyang-toggle-heart {
      left: 25px; /* ์˜ค๋ฅธ์ชฝ์œผ๋กœ ์ด๋™ */
    }

    .nyang-more-box {
      width: 200px;
      height: 0;
      background-color: #fff;
      color: #333;
      text-align: center;
      padding: 0;
      margin-top: 10px;
      transition: height 0.3s ease, padding 0.3s ease;
      border-radius: 8px;
      overflow: hidden;
    }

    .nyang-more-box.active {
      height: 60px;
      padding: 10px;
    }

  </style>
</head>
<body>

  <div class="nyang-toggle-container">
    <div class="nyang-toggle-button" id="nyangToggleButton">
      <span class="nyang-toggle-heart">♥</span>
    </div>
    <div class="nyang-more-box" id="nyangMoreBox">
      ์•ˆ๋…•ํ•˜์„ธ์š”^^
    </div>
  </div>

  <script>
    const toggleButton = document.getElementById('nyangToggleButton');
    const moreBox = document.getElementById('nyangMoreBox');

    toggleButton.addEventListener('click', () => {
      toggleButton.classList.toggle('active');
      moreBox.classList.toggle('active');
    });
  </script>

</body>
</html>
ํ˜„์žฌ๊ธ€
ํ† ๊ธ€ ๋ฒ„ํŠผ์œผ๋กœ ๋”๋ณด๊ธฐ ๊ธฐ๋Šฅ ์ ์šฉ์‹œํ‚ค๊ธฐ