[WordPress] 外掛分享: Lightbox for Gallery & Image Block

首頁外掛目錄 › Lightbox for Gallery & Image Block
20,000+
安裝啟用
★★★★★
5/5 分(88 則評價)
46 天前
最後更新
50%
問題解決
WordPress 5.4+ PHP 5.3+ v1.16.1 上架:2020-06-03

內容簡介

這個 WordPress 外掛為標準 WordPress 圖庫及圖像區塊新增了一個簡單輕量的 Lightbox,它可以偵測文章是否包含圖庫或圖像區塊,然後載入並啟動 baguetteBox.js,這是一個純 JavaScript 輕量級輪播套件,沒有任何依賴,且具有現代極簡風格。

這個外掛無鎖定效應。它不會新增 Block Editor/Gutenberg 區塊,且僅依賴標準 WordPress 圖庫和圖像區塊。您可以隨時停用此外掛,且您的圖庫和圖像區塊將如之前一樣運作。只是沒有輕箱效果。

只需記住一件很重要的事情:您必須為所有圖庫和圖像選擇「鏈結到→媒體檔案」才能正確運作。如果您選擇「無」或「附件頁面」,它將無法運作。但如果您不想為特定圖像或圖庫啟用輕箱效果,這樣做也沒有問題。

功能

以下是 baguetteBox.js 的功能:

純 JavaScript 編寫
無依賴 (例如 jQuery)
支援圖像標題
自適應
支援滑動手勢
大小約 13 KB,gzip 壓縮後約 7 KB

相容性

圖庫區塊 (預設區塊)
圖像區塊 (預設區塊)
媒體與文字區塊 (預設區塊)
圖庫 (預設經典編輯器圖庫)
CoBlocks 圖庫拼貼 / 瀑布流 / 位移 / 疊放
Meow 圖庫 (+ 圖庫區塊)
GenerateBlocks 圖像 (設定「啟用動態資料」→「連結來源」為「單一圖像」)

不要忘記為所有圖庫和圖像選擇「鏈結到→媒體檔案」,以使其正確運作。

注意:目前僅支援文章內的區塊,不支援小工具內的區塊。您可以讓它運作,但必須自行併入必要的樣式和 script 。請參閱 FAQ → 如何併入必要的資產 (script 和樣式),以便為文章外的區塊或預設不支援的區塊類型併入必要的資產?

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.16.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Lightbox for Gallery & Image Block」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This WordPress Plugin adds a simple & lightweight Lightbox to the standard WordPress Gallery & Image Block. It detects if a post contains a Gallery or Image Block and then loads & initialize baguetteBox.js, a pure JavaScript Lightbox script without any dependencies and a modern minimal look.
There is no lock in effect. It does not add a new Block Editor/Gutenberg Block and relies solo on the standard WordPress Gallery and Image Block. You can deactivate this plugin at any time and your Gallery and Image Blocks will work as they’ve done before. Just without the lightbox.
Just one important thing to remember: You always have to select Link → Link to image file or Link images to media file (see screenshots below) for all of your Image & Gallery Blocks to work properly. If you choose None or Link to attachment page it will not work. But that’s fine if you don’t want the Lightbox for a specific Image or Gallery.
Take a look at the YouTube video from Jakson where he reviews this plugin:

Features
Here are the features of baguetteBox.js:

Written in pure JavaScript
No dependencies (e.g. jQuery)
Image captions support
Responsive
Supports swipe gestures
Around 13 KB, 7 KB gzipped

Works with

Gallery Block (Default Block)
Image Block (Default Block)
Media and Text Block (Default Block)
Gallery (Default Classic Editor Gallery)
CoBlocks Gallery Collage / Masonry / Offset / Stacked
Meow Gallery (+ Gallery Block)

Don’t forget to select Link to → Media File for all of your Galleries & Images to work properly.
Notice: At the moment, just Blocks inside a post are supported. Not Blocks in a Widget. You can make it work but have to enqueue the necessary style & script yourself. See FAQ –> How to enqueue the necessary assets (script & style) for blocks outside of posts or for block types that are not supported by default?

延伸相關外掛

文章
Filter
Apply Filters
Mastodon