GalleryPlugin Styles
Adds a gallery on the bottom of the viewer to navigate between multiple panoramas.
This plugin is available in the @photo-sphere-viewer/gallery-plugin package.
WARNING
GalleryPlugin is not compatible with ResolutionPlugin.
Usage
The plugin has a list of items
, each configuring the corresponding panorama, a name and a thumbnail.
import { GalleryPlugin } from '@photo-sphere-viewer/gallery-plugin';
const viewer = new Viewer({
plugins: [
[GalleryPlugin, {
items: [
{
id: 'pano-1',
name: 'Panorama 1',
panorama: 'path/to/pano-1.jpg',
thumbnail: 'path/to/pano-1-thumb.jpg',
},
{
id: 'pano-2',
name: 'Panorama 2',
panorama: 'path/to/pano-2.jpg',
thumbnail: 'path/to/pano-2-thumb.jpg',
},
],
}],
],
});
Example
Configuration
items
- type:
GalleryItem[]
- updatable: no, use
setItems()
method
The list of items, see below.
visibleOnLoad
- type:
boolean
- default:
false
- updatable: no
Displays the gallery when loading the first panorama. The user will be able to toggle the gallery with the navbar button.
hideOnClick
- type:
boolean
- default:
true
- updatable: yes
Hides the gallery when the user clicks on an item (forced to true
on screens < 500px).
thumbnailSize
- type:
{ width: number, height: number }
- default:
{ width: 200, height: 100 }
- updatable: yes
Size of the thumbnails.
lang
- type:
object
- default:
lang: {
gallery: 'Gallery',
}
Note: this option is not part of the plugin but is merged with the main lang
object.
Items
id
(required)
- type:
number|string
Unique identifier of the item.
thumbnail
(recommended)
- type:
string
- default:
''
URL of the thumbnail.
name
- type:
string
- default:
''
Text visible over the thumbnail.
panorama
(required)
Refer to the main config page.
options
- type:
PanoramaOptions
- default:
null
Any option supported by the setPanorama() method.
Methods
setItems(items)
Changes the list of items.
Buttons
This plugin adds buttons to the default navbar:
gallery
allows to toggle the gallery panel
If you use a custom navbar you will need to manually add the buttons to the list.
SCSS variables
variable | default | description |
---|---|---|
$psv-gallery-breakpoint | 500px | Screen size below which the gallery is displayed full-height |
$psv-gallery-padding | 15px | Padding of the container |
$psv-gallery-border | 1px solid $psv-caption-text-color | Border between the gallery and the navbar |
$psv-gallery-background | $psv-navbar-background | Background of the gallery |
$psv-gallery-item-radius | 5px | Corner radius of gallery items |
$psv-gallery-item-active-border | 3px solid white | Border of active gallery item |
$psv-gallery-title-font | $psv-caption-font | Font of the gallery item title |
$psv-gallery-title-color | $psv-caption-text-color | Color of the gallery item title |
$psv-gallery-title-background | rgba(0, 0, 0, .6) | Background of the gallery item title |
$psv-gallery-thumb-hover-scale | 1.2 | Scale factor of thumbnails on mouse hover |