render with unique ids
This commit is contained in:
parent
d25de5493e
commit
414217e069
|
@ -70,14 +70,12 @@ class PanoramaViewer extends AbstractBlockLayout
|
|||
}
|
||||
|
||||
$urls = [];
|
||||
$pannellum_ids = [];
|
||||
$id = 1;
|
||||
static $id = 0;
|
||||
|
||||
foreach ($attachments as $attachment)
|
||||
{
|
||||
foreach($attachment->item()->media() as $media)
|
||||
{
|
||||
$id = $id +1;
|
||||
array_push($pannellum_ids, "pv-{$id}");
|
||||
$mediaType = $media->mediaType();
|
||||
$mediaRenderer = $media->renderer();
|
||||
if (strpos($mediaType, 'image/') !== false) {
|
||||
|
@ -91,7 +89,7 @@ class PanoramaViewer extends AbstractBlockLayout
|
|||
'title' => $block->dataValue('title'),
|
||||
'height' => $block->dataValue('height'),
|
||||
'urls' => $urls,
|
||||
'pannellum_ids' => $pannellum_ids,
|
||||
'id' => 'pv-' . ++$id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
</style>
|
||||
|
||||
<div class="pannellum">
|
||||
<div id="<?= $pannellum_ids[0] ?>" class="panorama-viewer"></div>
|
||||
<div id="<?= $id ?>" class="panorama-viewer"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
pannellum.viewer("<?= $pannellum_ids[0] ?>", {
|
||||
pannellum.viewer("<?= $id ?>", {
|
||||
type: "<?= $panorama_type ?>",
|
||||
autoLoad: true,
|
||||
panorama: "<?= $urls[0]; ?>",
|
||||
|
|
Loading…
Reference in New Issue