Accordion / 009 — レトロゲーム|Retro Gaming
デザイン見本
- Classic CRT monitor style
- Green neon glow effects
- Retro gaming atmosphere
懐かしいCRTモニター風のレトロゲームデザイン。 スキャンラインアニメーションやモノスペースフォント、強烈なネオングリーンが特徴です。
実装コード
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>Retro gaming atmosphere</li>
</ul>
</div>
</div>
CSS
/* アニメーション定義 */
@keyframes acc9-retroFadeIn {
0% {
opacity: 0;
transform: translateY(-10px)
}
100% {
opacity: 1;
transform: none
}
}
@keyframes acc9-scanLine {
0% {
transform: translateX(-100%)
}
100% {
transform: translateX(100%)
}
}
.container {
width: 100%;
background: #0a0a0a;
padding: 12px;
border-radius: 8px;
}
.container .btn-box button {
width: 100%;
padding: 14px 20px;
background: #000;
border: 2px solid #00ff00;
border-radius: 8px;
font-size: 13px;
font-weight: 700;
color: #00ff00;
cursor: pointer;
transition: all 0.3s ease;
text-align: left;
position: relative;
font-family: 'Courier New', 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, #00ff00, transparent);
animation: acc9-scanLine 2s linear infinite;
}
.container .btn-box button::after {
content: '▼';
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
color: #00ff00;
transition: transform 0.3s ease;
}
.container .btn-box button:hover {
background: rgba(0, 255, 0, 0.1);
}
.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;
}
.container .more.appear {
max-height: 200px;
animation: acc9-retroFadeIn 0.4s ease;
}
.container:has(.more.appear) .btn-box button::after {
transform: translateY(-50%) rotate(180deg);
}
.container .more ul {
list-style: none;
padding: 12px 16px;
margin: 0;
}
.container .more li {
padding: 8px 0;
color: #00ff00;
font-family: 'Courier New', monospace;
font-size: 12px;
border-bottom: 1px solid rgba(0, 255, 0, 0.2);
text-shadow: 0 0 3px rgba(0, 255, 0, 0.5);
}
.container .more li::before {
content: '>';
margin-right: 8px;
}
.container .more li:last-child {
border-bottom: none;
}
JS
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('.container').forEach(container => {
const button = container.querySelector('.btn-box button');
const content = container.querySelector('.more');
if (button && content) {
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;
}
});
}
});
});