ダイアログボックス:3Dエフェクト|Dialog Box: 3D Effect

3D Effect Dialog

This dialog uses advanced 3D effects and perspective transformations to create a modern, immersive experience.

HTML
<div class="container">
    <button id="dialog-btn">3D Effect<br>Dialog</button>     
</div>

<!-- Dialog Window -->
<div id="dialog" class="dialog">
    <div class="dialog-content">
        <div class="three-d-header">
            <span>3D Effect Dialog</span>
        </div>
        <div class="three-d-body">
            <p>This dialog uses advanced 3D effects and perspective transformations to create a modern, immersive experience.</p>
        </div>
        <div class="three-d-footer">
            <button class="three-d-btn">Continue</button>
        </div>
    </div>
</div>
CSS
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    text-align: center;
}

#dialog-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 200px;
    min-height: 60px;
    display: inline-block;
    text-align: center;
    line-height: 1.4;
    vertical-align: middle;
}

#dialog-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.dialog {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.dialog-content {
    width: 80%;
    max-width: 500px;
    margin: 8% auto;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
    transform: perspective(1000px) rotateX(5deg);
    transition: transform 0.3s ease;
    animation: slideInFromTop 0.3s ease-out;
}

.dialog-content:hover {
    transform: perspective(1000px) rotateX(0deg) scale(1.02);
}

.three-d-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
    position: relative;
    transform: perspective(1000px) rotateX(-5deg);
    transform-origin: bottom;
}

.three-d-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.three-d-header span {
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.three-d-body {
    padding: 25px 20px;
    background: rgba(255, 255, 255, 0.8);
    position: relative;
}

.three-d-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

.three-d-body p {
    margin: 0;
    line-height: 1.6;
    color: #555;
    font-size: 16px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.three-d-footer {
    padding: 20px;
    text-align: center;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
}

.three-d-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.three-d-btn {
    background: linear-gradient(145deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(0, 123, 255, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.three-d-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.three-d-btn:hover::before {
    left: 100%;
}

.three-d-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 123, 255, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.three-d-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 10px rgba(0, 123, 255, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .dialog-content {
        width: 90%;
        margin: 15% auto;
    }
    
    .three-d-header span {
        font-size: 18px;
    }
    
    .three-d-body p {
        font-size: 14px;
    }
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
    const dialogBtn = document.getElementById('dialog-btn');
    
    dialogBtn.addEventListener('click', function() {
        const dialog = document.getElementById('dialog');
        if (dialog) {
            dialog.style.display = 'block';
            document.body.style.overflow = 'hidden';
        }
    });
    
    const closeBtn = document.querySelector('.three-d-btn');
    
    closeBtn.addEventListener('click', function() {
        const dialog = this.closest('.dialog');
        if (dialog) {
            dialog.style.display = 'none';
            document.body.style.overflow = 'auto';
        }
    });
});
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次