Dialog / 10 ガラスモーフィズム|Glassmorphism
デザイン見本
Glassmorphism Dialog
ガラスモーフィズム効果のダイアログボックスです。
ガラスモーフィズム効果のダイアログボックスです。
実装コード
HTML
<button id="dialog-btn-10">Glassmorphism<br>Dialog</button>
<div id="dialog-10" class="dialog">
<div class="dialog-content">
<div class="glass-header">
<span>Glassmorphism Dialog</span>
</div>
<div class="glass-body">
<p>ガラスモーフィズム効果のダイアログボックスです。</p>
</div>
<div class="glass-footer">
<button class="glass-btn">Close</button>
</div>
</div>
</div>
CSS
#dialog-btn-10 {
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-10:hover {
background-color: #0056b3;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}
#dialog-10 {
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-10 0.3s;
}
#dialog-10 .dialog-content {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 20px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
overflow: hidden;
width: 80%;
max-width: 500px;
margin: 8% auto;
animation: slideInFromTop-10 0.2s ease-out;
}
#dialog-10 .glass-header {
background: rgba(255, 255, 255, 0.1);
color: #fff;
padding: 20px;
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
#dialog-10 .glass-header span {
margin: 0;
font-size: 20px;
font-weight: 600;
color: #fff;
}
#dialog-10 .glass-body {
padding: 20px;
background: rgba(255, 255, 255, 0.05);
}
#dialog-10 .glass-body p {
margin: 0;
line-height: 1.6;
color: #fff;
}
#dialog-10 .glass-footer {
padding: 20px;
text-align: center;
background: rgba(255, 255, 255, 0.1);
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
#dialog-10 .glass-btn {
background: rgba(255, 255, 255, 0.2);
color: #fff;
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 10px 20px;
border-radius: 25px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
#dialog-10 .glass-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
@keyframes fadeIn-10 {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideInFromTop-10 {
from {
transform: translateY(-50px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@media (max-width: 768px) {
#dialog-10 .dialog-content {
width: 90%;
margin: 15% auto;
}
#dialog-10 .glass-header span {
font-size: 18px;
}
#dialog-10 .glass-body p {
font-size: 14px;
}
}
JS
(function () {
var btn = document.getElementById('dialog-btn-10');
var dialog = document.getElementById('dialog-10');
var closeBtns = dialog ? dialog.querySelectorAll('button') : [];
if (!btn || !dialog) return;
function openDialog() {
dialog.style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closeDialog() {
dialog.style.display = 'none';
document.body.style.overflow = 'auto';
}
btn.addEventListener('click', openDialog);
closeBtns.forEach(function(b) { b.addEventListener('click', closeDialog); });
dialog.addEventListener('click', function (e) {
if (e.target === dialog) {
closeDialog();
}
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && dialog.style.display === 'block') {
closeDialog();
}
});
})();