PSV Gallery Demo

by mistic100

HTML

<script src="https://cdn.jsdelivr.net/npm/uevent@2/browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three/build/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.css">
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/gallery.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/gallery.css">
<div id="photosphere"></div>

CSS

html, body, #photosphere {
  margin: 0;
  width: 100%;
  height: 100%;
}

JavaScript

const base = 'https://photo-sphere-viewer-data.netlify.app/assets/';

const viewer = new PhotoSphereViewer.Viewer({
  container: 'photosphere',
  loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
  panorama: base + 'sphere.jpg',
  caption: 'Parc national du Mercantour <b>&copy; Damien Sorel</b>',
  defaultLat: 0.1,
  touchmoveTwoFingers: true,
  mousewheelCtrlKey: true,
  plugins: [
    [PhotoSphereViewer.GalleryPlugin, {
      visibleOnLoad: true,
    }],
  ],
});

const gallery = viewer.getPlugin(PhotoSphereViewer.GalleryPlugin);

gallery.setItems([
  {
    id       : 'sphere',
    panorama : base + 'sphere.jpg',
    thumbnail: base + 'sphere-small.jpg',
    options  : {
      caption: 'Parc national du Mercantour <b>&copy; Damien Sorel</b>',
    },
  },
  {
    id      : 'sphere-test',
    panorama: base + 'sphere-test.jpg',
    name    : 'Test sphere',
  },
  {
    id       : 1,
    panorama : base + 'tour/key-biscayne-1.jpg',
    thumbnail: base + 'tour/key-biscayne-1-thumb.jpg',
    name     : 'One',
    options  : {
      caption: 'Cape Florida Light, Key Biscayne <b>&copy; Pixexid</b>',
    },
  },
  {
    id       : 2,
    panorama : base + 'tour/key-biscayne-2.jpg',
    thumbnail: base + 'tour/key-biscayne-2-thumb.jpg',
    name     : 'Two',
    options  : {
      caption: 'Cape Florida Light, Key Biscayne <b>&copy; Pixexid</b>',
    },
  },
  {
    id       : 3,
    panorama : base + 'tour/key-biscayne-3.jpg',
    thumbnail: base + 'tour/key-biscayne-3-thumb.jpg',
    name     : 'Three',
    options  : {
      caption: 'Cape Florida Light, Key Biscayne <b>&copy; Pixexid</b>',
    },
  },
  {
    id       : 4,
    panorama : base + 'tour/key-biscayne-4.jpg',
    thumbnail: base + 'tour/key-biscayne-4-thumb.jpg',
    name     : 'Four',
    options  : {
      caption: 'Cape Florida Light, Key Biscayne <b>&copy; Pixexid</b>',
    },
  },
  {
    id       : 5,
    panorama : base + 'tour/key-biscayne-5.jpg',
    thumbnail: base +...