ポップアップウィンドウ:コミック|Pop-up Window: Comic

HTML
<div class="container">
  <button class="popup-btn" id="popup-btn">Comic Style</button>
  <div class="popup" id="popup">
    <div class="popup-content">
      <p>Comic Style Popup</p>
      <p>コミック風の吹き出しデザインのポップアップウィンドウです。</p>
    </div>
  </div>
</div>
CSS
body {
  background: #fff;
  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(-6deg); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.05) rotate(2deg); }
  80% { opacity: 1; transform: translateX(-50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.7) rotate(6deg); }
}

.popup-content {
  background: #fff;
  padding: 32px 36px;
  border-radius: 32px 16px 32px 16px;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 8px 32px #ff9966, 0 2px 8px rgba(0,0,0,0.08);
  border: 4px solid #ff5e62;
  font-size: 20px;
  position: relative;
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
}

.popup-content::before {
  content: '';
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 30px;
  background: #fff;
  border: 4px solid #ff5e62;
  border-radius: 50% 50% 0 0;
  z-index: 1;
  box-shadow: 0 -4px 0 #ff9966;
}

.popup-content p:first-child {
  font-size: 28px;
  margin-bottom: 12px;
  color: #ff5e62;
  font-weight: bold;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 #ff9966;
}

.popup-content p:last-of-type {
  font-size: 16px;
  color: #ff5e62;
  margin-bottom: 0;
  line-height: 1.7;
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
}
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');
});
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次