モーダルウィンドウ:レトロポップ|Modal Window: Retro Pop
2025
7/23
Open Retro Pop Modal
[Retro Pop Modal]
A modal window featuring retro pop colors and bold patterns reminiscent of the 1980s. It creates a sense of nostalgia and playfulness.
Close
HTML
<div class="container">
<h1>Retro Pop Modal</h1>
<button class="modal-btn">Open Retro Pop Modal</button>
</div>
<div class="mask"></div>
<div class="modal">
<div class="modal-content">
<p>[Retro Pop Modal]</p>
<p>A modal window featuring retro pop colors and bold patterns reminiscent of the 1980s. It creates a sense of nostalgia and playfulness.</p>
<div class="close-btn-container">
<button class="close-btn">Close</button>
</div>
</div>
</div>
CSS
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 20px;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
text-align: center;
color: #222;
}
h1 {
margin-bottom: 30px;
font-size: 2.5em;
text-shadow: 1px 1px 0 #fff59d;
}
.modal-btn {
padding: 15px 30px;
background: repeating-linear-gradient(135deg, #ffeb3b, #ffeb3b 10px, #ff4081 10px, #ff4081 20px);
color: #222;
border: 2px solid #ff4081;
border-radius: 18px;
font-size: 16px;
font-weight: 700;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 16px rgba(255, 64, 129, 0.2);
}
.modal-btn:hover {
background: repeating-linear-gradient(135deg, #ff4081, #ff4081 10px, #ffeb3b 10px, #ffeb3b 20px);
color: #fff;
}
.mask {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(255, 235, 59, 0.7);
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) rotate(-2deg);
background: repeating-linear-gradient(135deg, #fff, #fff 20px, #ffeb3b 20px, #ffeb3b 40px);
padding: 40px;
border-radius: 24px;
z-index: 1001;
opacity: 0; visibility: hidden;
transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
max-width: 500px; width: 90%;
box-shadow: 0 12px 32px rgba(255, 64, 129, 0.25);
border: 4px dashed #ff4081;
}
.modal.appear {
opacity: 1; visibility: visible;
transform: translate(-50%, -50%) scale(1) rotate(0deg);
}
.modal p {
color: #ff4081;
font-weight: 700;
text-shadow: 1px 1px 0 #fff59d;
text-align: center;
margin-bottom: 24px;
}
.close-btn {
padding: 12px 24px;
background: #ff4081;
color: #fff;
border: none;
border-radius: 12px;
font-size: 16px;
font-weight: 700;
cursor: pointer;
transition: background 0.3s;
display: block;
margin: 0 auto;
}
.close-btn:hover {
background: #ffeb3b;
color: #ff4081;
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
const modalBtn = document.querySelector('.modal-btn');
const mask = document.querySelector('.mask');
const modal = document.querySelector('.modal');
const closeBtn = modal.querySelector('.close-btn');
modalBtn.addEventListener('click', () => {
mask.classList.add('appear');
modal.classList.add('appear');
});
mask.addEventListener('click', () => {
closeModal();
});
closeBtn.addEventListener('click', () => {
closeModal();
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeModal();
}
});
function closeModal() {
mask.classList.remove('appear');
modal.classList.remove('appear');
}
});