← 一覧へ

Popup / 01 シンプル|Simple

デザイン見本

シンプルで使いやすい標準的なポップアップウィンドウです。下からスライドして表示され、一定時間後に自動的に消えます。

実装コード

HTML
<div id="popup-container-1">
  <button id="popup-btn-1">Simple</button>
</div>
<div id="popup-1" class="popup-1">
  <div class="popup-content-1">
    <p>Simple Popup</p>
    <p>シンプルで使いやすいポップアップウィンドウです。</p>
  </div>
</div>
CSS
/* Button Style */
#popup-btn-1 {
  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;
}

#popup-btn-1:hover {
  opacity: 0.5;
}

/* Popup Style */
.popup-1 {
  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-1.active {
  opacity: 1;
  visibility: visible;
  bottom: 20px;
  transform: translateX(-50%);
  animation: popupShowHide 3.4s ease forwards;
}

@keyframes popupShowHide {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(100%);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(100%);
  }
}

.popup-content-1 {
  background: white;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  position: relative;
  min-width: 300px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: 2px solid #007bff;
}

.popup-content-1 p:first-child {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #007bff;
}

.popup-content-1 p:last-of-type {
  font-size: 16px;
  color: #666;
  margin-bottom: 25px;
  line-height: 1.6;
}
JS
var btn = document.getElementById('popup-btn-1');
var popup = document.getElementById('popup-1');

if (btn && popup) {
  btn.addEventListener('click', function () {
    popup.classList.add('active');
  });

  popup.addEventListener('animationend', function () {
    popup.classList.remove('active');
  });
}