パーツ番号 08-04-07 ・ JavaScript使用
ブラー溶け込み遷移
ページ切り替え時にぼかしをかけて溶け込ませる演出。ギャラリーサイトの作品詳細表示に。
プレビュー
ソースコード
HTML
<div class="d08-04-07-stage">
<div class="d08-04-07-page d08-04-07-a">
<strong>ギャラリー</strong>
<p>作品一覧</p>
</div>
<div class="d08-04-07-page d08-04-07-b">
<strong>作品詳細</strong>
<p>拡大表示</p>
</div>
<button type="button" class="d08-04-07-btn">開く</button>
</div>CSS
.prev.d08-04-07{padding:0;}
.d08-04-07-stage{position:absolute;inset:0;overflow:hidden;font-family:sans-serif;}
.d08-04-07-page{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:#fff;transition:filter .6s ease,opacity .6s ease;}
.d08-04-07-a{background:linear-gradient(135deg,#0f172a,#334155);filter:blur(0);opacity:1;z-index:2;}
.d08-04-07-b{background:linear-gradient(135deg,#eab308,#f59e0b);filter:blur(10px);opacity:0;z-index:1;}
.d08-04-07-stage.is-b .d08-04-07-a{filter:blur(10px);opacity:0;}
.d08-04-07-stage.is-b .d08-04-07-b{filter:blur(0);opacity:1;}
.d08-04-07-page strong{font-size:18px;}
.d08-04-07-page p{font-size:12px;margin:0;opacity:.85;}
.d08-04-07-btn{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);z-index:3;border:none;border-radius:999px;padding:6px 16px;font-size:12px;background:#fff;color:#333;cursor:pointer;}JavaScript
(function(){
var box=document.currentScript.closest('.item').querySelector('.d08-04-07');
var stage=box.querySelector('.d08-04-07-stage');
var btn=box.querySelector('.d08-04-07-btn');
var on=false;
btn.addEventListener('click',function(){
on=!on;
stage.classList.toggle('is-b',on);
btn.textContent=on?'一覧へ戻る':'開く';
});
})();クラス名 .d08-04-07 は本ライブラリ内での識別用です。複数のパーツを同じページで使う場合は、重複しないよう名前を変更してください。