做相簿網站時,如何讓訪客從縮圖列表流暢地放大瀏覽?本文以 clearbox 插件示範一款圖片列表點擊彈出大圖層的效果,還能像投影片一樣連續播放整個相簿。
效果體驗:
https://hovertree.com/texiao/jqimg/1/
Demo 2:
https://hovertree.com/texiao/jqimg/1/1/
效果圖:
相簿由一個 .playbox 容器與多個縮圖連結組成。每個連結透過 rel="clearbox[test1]" 屬性歸在同一個相簿群組,點擊後即可播放該組圖片:
<div class="playbox">
<a href="images/1.jpg" rel="clearbox[test1]">
<img src="images/1.jpg" />
<div class="txt"><h3>性感美女</h3><p>說明文字</p></div>
</a>
<a href="images/2.jpg" rel="clearbox[test1]">
<img src="images/2.jpg" />
</a>
</div>除了放大瀏覽,還可加上從底部上升的遮罩描述效果。滑鼠移到縮圖上時,半透明的文字層會向上滑開,露出標題與說明:
$(".playbox a").hover(function(){
$(this).find(".txt").stop().animate({height:"360px"},200);
},function(){
$(this).find(".txt").stop().animate({height:"45px"},200);
});引入 clearbox 的樣式表、腳本與 jQuery 後即可使用;若不需要遮罩層,也可自行刪除相關結構。
<link href="https://hovertree.com/texiao/jqimg/1/css/clearbox.css" rel="stylesheet" type="text/css" />
<script src="https://hovertree.com/texiao/jqimg/1/js/clearbox.js"></script>源碼下載:
https://hovertree.com/h/bjaf/ljn1fwka.htm