Holographic Dialog
This dialog features a futuristic holographic design with iridescent effects, transparency layers, and sci-fi aesthetics that create an immersive experience.
HTML
<div class="container">
<button class="dialog-btn" id="dialog-btn">Holographic<br>Dialog</button>
</div>
<div id="dialog" class="dialog">
<div class="dialog-content">
<div class="holographic-header">
<div class="holographic-icon">🌟</div>
<span>Holographic Dialog</span>
</div>
<div class="holographic-body">
<p>This dialog features a futuristic holographic design with iridescent effects, transparency layers, and sci-fi aesthetics that create an immersive experience.</p>
</div>
<div class="holographic-footer">
<button class="holographic-btn-secondary">Cancel</button>
<button class="holographic-btn-primary">Activate</button>
</div>
</div>
</div>
CSS
.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: 10% auto;
background: linear-gradient(135deg,
rgba(138, 43, 226, 0.5),
rgba(75, 0, 130, 0.5),
rgba(138, 43, 226, 0.5));
border: 2px solid transparent;
border-radius: 20px;
padding: 30px;
position: relative;
backdrop-filter: blur(10px);
box-shadow:
0 0 30px rgba(138, 43, 226, 0.3),
0 0 60px rgba(75, 0, 130, 0.2),
inset 0 0 30px rgba(255, 255, 255, 0.1);
animation: holographicGlow 3s ease-in-out infinite alternate, floatIn 0.6s ease-out;
}
.holographic-header {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(138, 43, 226, 0.3);
}
.holographic-icon {
font-size: 2em;
animation: holographicFloat 2s ease-in-out infinite;
}
.holographic-header span {
font-size: 1.5em;
font-weight: 600;
background: white;
background-size: 200% 200%;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
animation: holographicShift 3s ease-in-out infinite;
}
.holographic-body {
margin-bottom: 25px;
}
.holographic-body p {
color: rgba(255, 255, 255, 0.9);
line-height: 1.6;
font-size: 1em;
text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}
.holographic-footer {
display: flex;
gap: 15px;
justify-content: flex-end;
}
.holographic-btn-secondary,
.holographic-btn-primary {
padding: 12px 24px;
border: none;
border-radius: 25px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.holographic-btn-secondary {
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(138, 43, 226, 0.3);
}
.holographic-btn-secondary:hover {
background: rgba(138, 43, 226, 0.2);
border-color: rgba(138, 43, 226, 0.6);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}
.holographic-btn-primary {
background: linear-gradient(45deg, #8a2be2, #4b0082);
color: white;
border: 1px solid rgba(138, 43, 226, 0.5);
}
.holographic-btn-primary:hover {
background: linear-gradient(45deg, #4b0082, #8a2be2);
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(138, 43, 226, 0.5);
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes floatIn {
0% {
transform: translateY(50px) scale(0.9);
opacity: 0;
}
100% {
transform: translateY(0) scale(1);
opacity: 1;
}
}
@keyframes holographicGlow {
0% {
border-color: rgba(138, 43, 226, 0.5);
box-shadow:
0 0 30px rgba(138, 43, 226, 0.3),
0 0 60px rgba(75, 0, 130, 0.2),
inset 0 0 30px rgba(255, 255, 255, 0.1);
}
100% {
border-color: rgba(75, 0, 130, 0.8);
box-shadow:
0 0 40px rgba(138, 43, 226, 0.5),
0 0 80px rgba(75, 0, 130, 0.3),
inset 0 0 40px rgba(255, 255, 255, 0.2);
}
}
@keyframes holographicFloat {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-5px); }
}
@keyframes holographicShift {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
@media (max-width: 768px) {
.dialog-content {
width: 90%;
margin: 15% auto;
padding: 15px;
}
.holographic-header span {
font-size: 16px;
}
.holographic-body p {
font-size: 14px;
}
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
// ダイアログボタンのイベントリスナーを設定
const dialogBtn = document.getElementById('dialog-btn');
const dialog = document.getElementById('dialog');
dialogBtn.addEventListener('click', function() {
dialog.style.display = 'block';
// スクロールを無効化
document.body.style.overflow = 'hidden';
});
// 閉じるボタンのイベントリスナーを設定
const closeButtons = document.querySelectorAll('.holographic-btn-secondary, .holographic-btn-primary');
closeButtons.forEach(button => {
button.addEventListener('click', function() {
dialog.style.display = 'none';
// スクロールを有効化
document.body.style.overflow = 'auto';
});
});
});