線上預覽 下載
spotlight.js是一款js彈出層Lightbox圖片畫廊外掛。該外掛在點選圖片的縮圖時,以lightbox的方式彈出圖片畫廊,支援對圖片進行放大、縮小、全屏、前後切換等操作。
使用方法
在頁面中引入下面的檔案。
< script type = "text/javascript" src = "spotlight.bundle.js.js" ></ script > |
HTML結構
< a class = "spotlight" href = "img1.jpg" > < img src = "thumb1.jpg" > </ a > < a class = "spotlight" href = "img2.jpg" > < img src = "thumb2.jpg" > </ a > < a class = "spotlight" href = "img3.jpg" > < img src = "thumb3.jpg" > </ a > |
也可以不使用a標籤。
< div class = "spotlight" data-src = "img1.jpg" > < div > <!-- ... --> </ div > </ a > |
要對圖片進行分組,使用spotlight-group
class即可。
< div class = "spotlight-group" > < a class = "spotlight" href = "dog1.jpg" > < img src = "dog1-thumb.jpg" > </ a > < a class = "spotlight" href = "dog2.jpg" > < img src = "dog2-thumb.jpg" > </ a > < a class = "spotlight" href = "dog3.jpg" > < img src = "dog3-thumb.jpg" > </ a > </ div > < div class = "spotlight-group" > < a class = "spotlight" href = "cat1.jpg" > < img src = "cat1-thumb.jpg" > </ a > < a class = "spotlight" href = "cat2.jpg" > < img src = "cat2-thumb.jpg" > </ a > < a class = "spotlight" href = "cat3.jpg" > < img src = "cat3-thumb.jpg" > </ a > </ div > |