← 一覧へ

Popup / 31 ポラロイド|Polaroid

デザイン見本

クリーム白の背景と厚底フレーム(::after 疑似要素)でポラロイド写真の外観を再現しました。 cubic-bezier(0.34, 1.56, 0.64, 1) のバネ感と -2deg の傾きが「そっと置いた写真」のような演出をします。

実装コード

HTML
<div id="popup-container-31">
    <button id="popup-btn-31">Polaroid</button>
</div>
<div id="popup-31" class="popup-31">
    <div class="popup-content-31">
        <p>Polaroid Popup</p>
        <p>写真プリントのような温かみのあるポラロイド風ポップアップです。</p>
    </div>
</div>
CSS
/* ボタン */
#popup-btn-31 {
    cursor: pointer;
    border: 2px solid #c9b48a;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 700;
    display: block;
    margin: 0 auto;
    width: 180px;
    background: #f5f0e8;
    color: #5c4a2a;
    box-shadow: 3px 3px 0 #c9b48a;
    transition: all 0.1s;
}
#popup-btn-31:active {
    box-shadow: 1px 1px 0 #c9b48a;
    transform: translate(2px, 2px);
}

/* ポップアップ外枠 */
.popup-31 {
    position: fixed;
    bottom: -100%;
    left: 50%;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90%;
}
.popup-31.active {
    opacity: 1;
    visibility: visible;
    bottom: 30px;
    animation: popupShowHide31 3.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* バネ感 + 傾きアニメーション */
@keyframes popupShowHide31 {
    0%   { opacity: 0; transform: translateX(-50%) translateY(80px) rotate(-8deg) scale(0.7); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0) rotate(-2deg) scale(1); }
    85%  { opacity: 1; transform: translateX(-50%) translateY(0) rotate(-2deg) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(80px) rotate(-8deg) scale(0.7); }
}

/* ポラロイド本体 */
.popup-content-31 {
    background: #fffef5;
    padding: 20px 24px 36px; /* 底部を広くしてポラロイドフレームに */
    border: 1px solid #e0d5c0;
    border-radius: 2px;
    text-align: center;
    position: relative;
    min-width: 280px;
    box-shadow: 4px 8px 24px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.1);
}

/* ポラロイド底部フレーム */
.popup-content-31::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #f5f0e8;
    border-top: 1px solid #e0d5c0;
    border-radius: 0 0 2px 2px;
}

.popup-content-31 p:first-child {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    color: #3a2e1a;
    letter-spacing: 1px;
    font-style: italic;
}
.popup-content-31 p:last-of-type {
    font-size: 13px;
    color: #7a6a50;
    margin-bottom: 0;
    line-height: 1.6;
}
JS
var btn = document.getElementById('popup-btn-31');
var popup = document.getElementById('popup-31');

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

    popup.addEventListener('animationend', function (e) {
        if (e.animationName.startsWith('popupShowHide')) {
            popup.classList.remove('active');
        }
    });
}