JeremyHeleine / Photo-Sphere-Viewer

A JavaScript library to display Photo Sphere panoramas.
854 stars 952 forks source link

Multiple panoramas at one page problem #53

Closed shervud closed 7 years ago

shervud commented 7 years ago

Hi. I'm trying to make a slider of 3d panoramas with a bootstrap js plugin "Carousel". Each slide (item) has own "data-blah-blah" attribute which one contains src of a spherical image. And in "for" cycle I'm trying to initial all this panoramas. But as a result only 1st slide works correct (which has display:block), when other is not (has display:none). Other words, when I slide next or prev, there is nothing to show. In CSS I did hard set height & width of item container, but canvas of other slides is always clear...

Issue have fixed by use follow work around: on 'slide.bs.carousel' event (changing current active slide) I'm initialing panoramas of current visible div again. But this is not good solutions I think.

What do you think?

JeremyHeleine commented 7 years ago

Hi,

By default, Photo Sphere Viewer displays a viewer that has the exact same size as the container. That means that, if you try to display a panorama in a container that has an empty size (or, equivalently here, a hidden container), the viewer will also be empty (the viewer is stupid). To load a panorama before displaying the corresponding container, you can use the option size. It's an object in which you can specify the final width and height of the viewer (size: {width: '50%', height: 500} for instance).

Does this option help you?

shervud commented 7 years ago

Yes, thank you much.