Accordion / 026 — ドットマーカー|Dot Marker
デザイン見本
- Minimal styling with dot indicators
- Subtle interactions
- Clean layout for text content
左側の小さなドットが状態を示すミニマルなデザイン。 主張しすぎないデザインで、洗練された印象を与えます。 展開時にドットが少し大きくなり、色が濃くなるアニメーション付き。
実装コード
HTML
<div class="container">
<div class="btn-box">
<button data-default-text="Dot Marker" data-open-text="Close">Dot Marker</button>
</div>
<div class="more">
<ul>
<li>Minimal styling with dot indicators</li>
<li>Subtle interactions</li>
<li>Clean layout for text content</li>
</ul>
</div>
</div>
CSS
.container {
width: 100%;
}
.container .btn-box button {
width: 100%;
padding: 20px 0 20px 24px;
background: transparent;
border: none;
border-bottom: 1px solid #eee;
font-size: 15px;
font-weight: 500;
color: #666;
cursor: pointer;
transition: all 0.3s ease;
text-align: left;
position: relative;
}
.container .btn-box button::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6px;
height: 6px;
background-color: #ccc;
border-radius: 50%;
transition: all 0.3s ease;
}
.container .btn-box button:hover {
color: #333;
}
.container .btn-box button:hover::before {
background-color: #999;
transform: translateY(-50%) scale(1.2);
}
.container .btn-box button.active {
color: #000;
font-weight: 600;
border-bottom-color: transparent;
}
.container .btn-box button.active::before {
background-color: #333;
transform: translateY(-50%) scale(1.5);
box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}
.container .more {
max-height: 0;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
background: #fafafa;
border-radius: 8px;
opacity: 0;
transform: translateY(-10px);
}
.container .more.appear {
max-height: 200px;
opacity: 1;
transform: translateY(0);
margin-bottom: 16px;
}
.container .more ul {
list-style: none;
padding: 24px;
margin: 0;
}
.container .more li {
padding: 6px 0;
color: #555;
font-size: 14px;
position: relative;
padding-left: 16px;
}
.container .more li::before {
content: '-';
position: absolute;
left: 0;
color: #999;
}
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');
this.classList.toggle('active');
// ボタンテキストの切り替え
if (content.classList.contains('appear')) {
this.textContent = this.dataset.openText || 'Close';
} else {
this.textContent = this.dataset.defaultText;
}
});
}
});
});