モーダルウィンドウ:ネオン風|Modal Window: Neon Style
【Neon Style Modal】
A cyberpunk-style modal window with neon effects. Features impactful visual effects.
HTML
<div class="container">
<button class="modal-button">Neon Style Modal</button>
<div class="mask"></div>
<div class="modal">
<div class="modal-content">
<p>【Neon Style Modal】</p>
<p>A cyberpunk-style modal window with neon effects. Features impactful visual effects.</p>
<div class="close-btn-container">
<button class="close-btn">Close</button>
</div>
</div>
</div>
</div>
CSS
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding: 20px;
background: #1a1a1a;
margin: 0;
color: #fff;
}
.container {
max-width: 800px;
margin: 0 auto;
text-align: center;
}
.modal-button {
padding: 15px 30px;
background: #1a1a1a;
color: #00ff88;
border: 2px solid #00ff88;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-shadow: 0 0 10px #00ff88;
box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}
.modal-button:hover {
background: #00ff88;
color: #1a1a1a;
text-shadow: none;
box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
transform: scale(1.05);
}
.mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.9);
z-index: 1000;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.mask.appear {
opacity: 1;
visibility: visible;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0.9);
background: #1a1a1a;
padding: 40px;
border-radius: 12px;
z-index: 1001;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
max-width: 500px;
width: 90%;
border: 2px solid #00ff88;
box-shadow: 0 0 30px rgba(0, 255, 136, 0.4);
}
.modal.appear {
opacity: 1;
visibility: visible;
transform: translate(-50%, -50%) scale(1);
}
.modal p {
color: #00ff88;
line-height: 1.7;
margin-bottom: 30px;
font-size: 16px;
text-shadow: 0 0 8px #00ff88;
text-align: center;
}
.close-btn {
padding: 12px 24px;
background: transparent;
color: #00ff88;
border: 2px solid #00ff88;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-shadow: 0 0 8px #00ff88;
box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
display: block;
margin: 0 auto;
}
.close-btn:hover {
background: #00ff88;
color: #1a1a1a;
text-shadow: none;
box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
transform: scale(1.05);
}
/* レスポンシブ対応 */
@media (max-width: 768px) {
.modal {
width: 95%;
padding: 20px;
}
.modal p {
font-size: 14px;
}
.modal-button {
font-size: 14px;
padding: 10px 20px;
}
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
const modalBtn = document.querySelector('.modal-button');
const mask = document.querySelector('.mask');
const modal = document.querySelector('.modal');
const closeBtn = document.querySelector('.close-btn');
// モーダルを開く
modalBtn.addEventListener('click', () => {
mask.classList.add('appear');
modal.classList.add('appear');
});
// マスクをクリックして閉じる
mask.addEventListener('click', () => {
mask.classList.remove('appear');
modal.classList.remove('appear');
});
// 閉じるボタンをクリックして閉じる
closeBtn.addEventListener('click', () => {
mask.classList.remove('appear');
modal.classList.remove('appear');
});
});