mistic100 / Photo-Sphere-Viewer

A JavaScript library to display 360° sphere panoramas.
https://photo-sphere-viewer.js.org
MIT License
1.87k stars 677 forks source link

Multiple spheres? #175

Closed kaludjer closed 6 years ago

kaludjer commented 6 years ago

Is it possible to initialize multiple Spheres? With multiple containers ofc.

mistic100 commented 6 years ago

did you try ?

kaludjer commented 6 years ago

Problem is because container value can be only element or ID. I changed it to allow classes and it's ok now. Thanks anyway.

mistic100 commented 6 years ago

So you mean you want the same sphere on multiple containers ? Clearly I will not support it.

kaludjer commented 6 years ago

Not same sphere, I made it gallery-like. You have for example 5 items with 5 different spheres but configuration has to be same.

mistic100 commented 6 years ago

ok, so why did you need to modify the library ?

Here using lodash extend and querySelector

PhotoSphereViewer(_.extend({
  panorama: 'image-1.jpg', 
  container: document.querySelector('.container-1')
}, defaultConfig));

Anyway I strongly advise against initializing multiple viewers at once, you will get awfully slow page by doing this.

Prefer having only one viewer and use the setPanorama method to switch between images.

kaludjer commented 6 years ago

Nice, tnx.