以前的WordPress核心程序是不支持图片灯箱(lightbox)功能的,只能通过插件或自己动手添加代码来实现。不过WordPress 6.4 版将改变现状,将大家呼声很高的图片灯箱加入到核心程序中,目前该版本正处在开发阶段。
内部开发版本最新日志(v0.3)
- Represent a preview of the currently selected lightbox animation effect in the sidebar
- Add support for variable mobile browser window height due to address bar being visible or not
- Clean up directives using Tag Processor bookmarks and HTML Processor
- Add aria-describedby if image has no alt but has caption #43059 (comment)
- Resize() callback for lightbox button does not always fire, causing horizontal overflow
- Add callback on window resize() to recenter lightbox when it is active
- Explore extending lightbox to include support for additional content types
- Explore extending lightbox to include support for galleries
- Add zoom on hover
- Disable lightbox when it is part of a gallery
- Explore using CSS background instead of JavaScript to improve animation performance
- Potential idea around Accelerated Mobile Pages and how it used width and height properties to perform layout adjustments before loading media
- Example of loading an image as a CSS background
编辑器中的灯箱选项演示

在WordPress 古腾堡编辑器中将提供相关选项。
扩展阅读
网页中的图片灯箱效果在桌面端而言对用户体验提升不大,毕竟桌面显示器本来较大,而且用户可以很方便通过链接查看原图。但在移动端网页浏览中,可提供图片灯箱效果供用户自由缩放的话,非常实用。