← 一覧へ

Popup / 03 グラデーション|Gradient

デザイン見本

美しいグラデーション背景を使用したポップアップです。半透明のボーダーやオーバーレイ効果により、奥行きと質感のある仕上がりになっています。

実装コード

HTML
<div id="popup-container-3">
  <button id="popup-btn-3">Gradient</button>
</div>
<div id="popup-3" class="popup-3">
  <div class="popup-content-3">
    <p>Gradient Popup</p>
    <p>美しいグラデーション効果のポップアップウィンドウです。</p>
  </div>
</div>
CSS
/* Button Style */
#popup-btn-3 {
  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-3:hover {
  opacity: 0.5;
}

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

@keyframes popupShowHide3 {
  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-3 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  position: relative;
  min-width: 300px;
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.2);
}

.popup-content-3::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(255, 255, 255, 0.1) 100%);
  border-radius: 12px;
  pointer-events: none;
}

.popup-content-3 p:first-child {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

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

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