😀🎉 Emoji Popup 🎮✨
絵文字を使ったポップで楽しいポップアップウィンドウです。
HTML
<div class="container">
<button class="popup-btn" id="popup-btn">Emoji</button>
<div class="popup" id="popup">
<div class="popup-content">
<p>😀🎉 Emoji Popup 🎮✨</p>
<p>絵文字を使ったポップで楽しいポップアップウィンドウです。</p>
</div>
</div>
</div>
CSS
body {
background: #fffbe7;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
width: 100%;
max-width: 400px;
margin: 0 auto;
text-align: center;
}
.popup-btn {
cursor: pointer;
border: none;
padding: 12px 24px;
border-radius: 16px;
color: #333;
background-color: #eee;
font-weight: 600;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
display: block;
margin: 0 auto;
width: 180px;
font-size: 18px;
transition: opacity 0.2s;
}
.popup-btn:hover {
opacity: 0.5;
}
.popup {
position: fixed;
bottom: -100%;
left: 50%;
transform: translateX(-50%);
z-index: 1001;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
max-width: 90%;
max-height: 90%;
}
.popup.active {
opacity: 1;
visibility: visible;
bottom: 20px;
transform: translateX(-50%);
animation: popupShowHide 3.4s cubic-bezier(.68,-0.55,.27,1.55) forwards;
}
@keyframes popupShowHide {
0% { opacity: 0; transform: translateX(-50%) scale(0.7) rotate(-10deg); }
20% { opacity: 1; transform: translateX(-50%) scale(1.05) rotate(3deg); }
80% { opacity: 1; transform: translateX(-50%) scale(1) rotate(0deg); }
100% { opacity: 0; transform: translateX(-50%) scale(0.7) rotate(10deg); }
}
.popup-content {
background: #fffbe7;
padding: 32px 36px;
border-radius: 32px;
text-align: center;
min-width: 300px;
box-shadow: 0 8px 32px #ffe066, 0 2px 8px rgba(0,0,0,0.08);
border: 3px dashed #ffb347;
font-size: 20px;
position: relative;
animation: emojiBounce 1.2s infinite alternate;
}
@keyframes emojiBounce {
0% { transform: translateY(0); }
100% { transform: translateY(-8px); }
}
.popup-content p:first-child {
font-size: 32px;
margin-bottom: 12px;
letter-spacing: 2px;
}
.popup-content p:last-of-type {
font-size: 16px;
color: #b8860b;
margin-bottom: 0;
line-height: 1.7;
}
JavaScript
const btn = document.getElementById('popup-btn');
const popup = document.getElementById('popup');
btn.addEventListener('click', function() {
popup.classList.add('active');
});
popup.addEventListener('animationend', function() {
popup.classList.remove('active');
});