アコーディオン:ネイチャー|Accordion: Nature

  • Natural wood grain texture
  • Organic color palette
  • Leaf-inspired patterns
  • Eco-friendly appearance
  • Warm and charming design
HTML
<div class="container">
    <div class="accordion">
        <div class="btn-box">
            <button data-default-text="Nature Accordion" data-open-text="Close">Nature Accordion</button>
        </div>
        <div class="more">
            <ul>
                <li>Natural wood grain texture</li>
                <li>Organic color palette</li>
                <li>Leaf-inspired patterns</li>
                <li>Eco-friendly appearance</li>
                <li>Warm and charming design</li>
            </ul>
        </div>
    </div>
</div>
CSS
@keyframes natureFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes holographicShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.accordion {
    margin: 25px 0;
    position: relative;
}

.btn-box button {
    width: 100%;
    padding: 20px 25px;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #CD853F 100%);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.btn-box button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(34, 139, 34, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(50, 205, 50, 0.2) 0%, transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.05) 2px,
            rgba(255, 255, 255, 0.05) 4px
        );
    border-radius: 12px;
    pointer-events: none;
}

 

.btn-box button:hover {
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 50%, #DEB887 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.more {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    background: linear-gradient(135deg, #F5DEB3 0%, #F4A460 50%, #DEB887 100%);
    border-radius: 0 0 12px 12px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    margin-top: -5px;
    position: relative;
    z-index: 1;
}

.more::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #228B22, #32CD32, #90EE90, #228B22);
    background-size: 200% 100%;
    animation: holographicShift 3s ease infinite;
}

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

.more ul {
    list-style: none;
    padding: 25px 28px;
    margin: 0;
}

.more li {
    padding: 15px 0;
    color: #654321;
    font-weight: 500;
    border-bottom: 1px solid rgba(101, 67, 33, 0.2);
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    padding-left: 0;
    transition: all 0.3s ease;
}

 

.more li:hover {
    color: #228B22;
    padding-left: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin: 0 -10px;
    padding-right: 10px;
}

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

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .btn-box button {
        font-size: 14px;
        padding: 18px 22px;
    }
    
    .more ul {
        padding: 20px 22px;
    }
    
    .more.appear {
        max-height: 400px;
    }
    
    .more li {
        font-size: 14px;
        padding: 12px 0;
    }
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
    const buttons = document.querySelectorAll('.btn-box button');
    
    buttons.forEach(button => {
        button.addEventListener('click', function() {
            const more = this.parentElement.nextElementSibling;
            const isOpen = more.classList.contains('appear');
            
            // 他のアコーディオンを閉じる
            document.querySelectorAll('.more').forEach(item => {
                item.classList.remove('appear');
            });
            
            // クリックされたアコーディオンの開閉
            if (!isOpen) {
                more.classList.add('appear');
                this.textContent = this.getAttribute('data-open-text');
            } else {
                more.classList.remove('appear');
                this.textContent = this.getAttribute('data-default-text');
            }
        });
    });
});
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次