アコーディオン:レトロゲーミング|Accordion: Retro Gaming

  • Classic CRT monitor style
  • Green neon glow effects
  • Scan line animations
  • Retro gaming atmosphere
  • Cyberpunk-inspired design
HTML
<div class="container">
  <div class="btn-box">
      <button data-default-text="Retro Gaming Accordion" data-open-text="Close">Retro Gaming Accordion</button>
  </div>
  <div class="more">
      <ul>
          <li>Classic CRT monitor style</li>
          <li>Green neon glow effects</li>
          <li>Scan line animations</li>
          <li>Retro gaming atmosphere</li>
          <li>Cyberpunk-inspired design</li>
      </ul>
  </div>
</div>
CSS
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.02) 2px,
            rgba(0, 255, 0, 0.02) 4px
        );
    pointer-events: none;
    z-index: -1;
}

.container {
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.03) 2px,
            rgba(0, 255, 0, 0.03) 4px
        );
    pointer-events: none;
    z-index: -1;
}

/* ========================================
   デザイン9: レトロゲーミングアコーディオン
   ======================================== */
@keyframes scanLine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes neonPulse {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.6), 0 0 20px rgba(0, 255, 0, 0.4);
  }
  50% { 
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8), 0 0 30px rgba(0, 255, 0, 0.6);
  }
}

@keyframes retroFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

.container .btn-box button {
  width: 100%;
  padding: 18px 25px;
  background: #000;
  border: 2px solid #00ff00;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #00ff00;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  position: relative;
  font-family: 'Courier New', 'Courier', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
  overflow: hidden;
}

.container .btn-box button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    #00ff00 50%, 
    transparent 100%);
  animation: scanLine 2s linear infinite;
}

.container .btn-box button::after {
  content: '▼';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
  color: #00ff00;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.container .btn-box button:hover {
  background: rgba(0, 255, 0, 0.1);
  color: #00ff00;
  text-shadow: 0 0 8px rgba(0, 255, 0, 1);
  animation: neonPulse 1.5s ease-in-out infinite alternate;
}

.container .more {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  background: #000;
  border: 2px solid #00ff00;
  border-top: none;
  border-radius: 0 0 8px 8px;
  position: relative;
}

.container .more::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    #00ff00 50%, 
    transparent 100%);
  animation: scanLine 3s linear infinite;
}

.container .more.appear {
  max-height: 500px;
  animation: retroFadeIn 0.4s ease;
}

.container:has(.more.appear) .btn-box button::after {
  transform: translateY(-50%) rotate(180deg);
}

.container .more ul {
  list-style: none;
  padding: 20px;
  margin: 0;
}

.container .more li {
  padding: 12px 0;
  color: #00ff00;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 14px;
  border-bottom: 1px solid rgba(0, 255, 0, 0.2);
  text-shadow: 0 0 3px rgba(0, 255, 0, 0.5);
  position: relative;
}

.container .more li::before {
  content: '>';
  margin-right: 10px;
  color: #00ff00;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.container .more li:hover {
  background: rgba(0, 255, 0, 0.05);
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.container .more li:last-child {
  border-bottom: none;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .container .btn-box button {
    font-size: 14px;
    padding: 15px 20px;
  }
  
  .container .more ul {
    padding: 15px;
  }
  
  .container .more.appear {
    max-height: 400px;
  }
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
    const button = document.querySelector('.btn-box button');
    const content = document.querySelector('.more');
    
    button.addEventListener('click', function() {
        content.classList.toggle('appear');
        
        // ボタンテキストの切り替え
        if (content.classList.contains('appear')) {
            this.textContent = this.dataset.openText || 'Close';
        } else {
            this.textContent = this.dataset.defaultText;
        }
    });
});
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次