Full Screen Images
View images on the full screen and pan around them with the mouse or touch position.
Install in
Full Screen Images opens an image on the full screen when a visitor clicks it. Moving the mouse, or touching and dragging, pans around the image, so large and detailed images can be seen up close.
- Works with any image or link that has the
full-screen-imageclass. - Optional title and caption at the bottom of the viewer.
- Optional higher resolution version of the image for the viewer.
- Closes on a click on the image or with the Escape key.
- Small and light: two small scripts, loaded in the footer, no jQuery, no settings to store.
How to use
Add the full-screen-image class to an image, or to a link to an image file. The element needs one of these attributes, pointing to an image file:
data-image: the image to open in the viewer, for example a higher resolution version;- otherwise, for images, the largest size in the image’s
srcset(WordPress adds it to images from the Media Library), or elsesrc; hreffor links.
To show a title and a caption, add the data-title and data-caption attributes. Without data-title, the title attribute is used. Both are shown as plain text.
Example:
<img class="full-screen-image" src="photo-1024.jpg" data-image="photo-4000.jpg" data-title="Harbour at dawn" data-caption="Taken from the old lighthouse." alt="Boats in a harbour at dawn">
In the block editor, select an Image block, open Advanced in the block settings, and add full-screen-image to Additional CSS class(es).
Settings Full Screen Images in the WordPress admin repeats these steps.
Third-party code
The viewer is based on Intense Image Viewer by Tim Holman, released under the MIT licence. The plugin ships a modified copy in js/intense.js, with the licence notice and a list of the changes at the top of the file.
Written by Joobi from the project's own listing. See the source page
1.1.0
- Security hardening of captions.
- Works with the Image block: add the
full-screen-imageclass under Advanced. Images linked to their file open in the viewer, links to pages keep working, and “Expand on click” uses the WordPress lightbox. - The viewer opens the largest image size available.
- The viewer is an accessible dialog: it takes the focus and gives it back on close, Tab stays inside it, and the enlarged image keeps its alt text.
- A click anywhere in the viewer closes it. Escape still works.
- Fixed: themes that limit image width (for example Twenty Twenty-One) moved the image off screen and broke panning.
- Fixed: a double click opened two viewers and left the page locked.
- Scripts load in the footer, deferred, without jQuery, with the plugin version for caching.
- The help page under Settings is translatable, and the “More Info” link points to it correctly.
- Requires WordPress 6.6 and PHP 7.4. Tested up to WordPress 7.1.
1.0.2
- PHPCS fixes.
- Tested up to WordPress 6.5.2.
1.0.1
- Tested up to WordPress 4.8.
1.0
- Plugin released.
Follow this listing's changes (Atom feed)