parent
d240f86d70
commit
ce9dbd0bb3
|
@ -72,6 +72,7 @@ class Sketchfab extends AbstractBlockLayout
|
||||||
|
|
||||||
$thumbnails = [];
|
$thumbnails = [];
|
||||||
static $id = 0;
|
static $id = 0;
|
||||||
|
$id = $id +1;
|
||||||
|
|
||||||
$media = $attachments[0]->item()->media()[0];
|
$media = $attachments[0]->item()->media()[0];
|
||||||
$media = $attachments[0]->item()->media()[0];
|
$media = $attachments[0]->item()->media()[0];
|
||||||
|
@ -81,7 +82,8 @@ class Sketchfab extends AbstractBlockLayout
|
||||||
|
|
||||||
return $view->partial('common/block-layout/sketchfab', [
|
return $view->partial('common/block-layout/sketchfab', [
|
||||||
'title' => $block->dataValue('title'),
|
'title' => $block->dataValue('title'),
|
||||||
'model_id' => $block->dataValue('identifier'),
|
//'model_id' => $block->dataValue('identifier'),
|
||||||
|
'model_id' => $id,
|
||||||
'renderSourceLink' => $block->dataValue('renderSourceLink'),
|
'renderSourceLink' => $block->dataValue('renderSourceLink'),
|
||||||
'item_url' => $attachments[0]->item()->url(),
|
'item_url' => $attachments[0]->item()->url(),
|
||||||
'width' => $block->dataValue('width'),
|
'width' => $block->dataValue('width'),
|
||||||
|
|
|
@ -21,12 +21,19 @@ $this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function() {
|
function adjust_height() {
|
||||||
var sketchfab = $("#sketchfab_<?= $model_id ?>").find('iframe');
|
$(".sketchfab-embed-wrapper").each(function() {
|
||||||
|
var sketchfab = $(this).find('iframe')
|
||||||
$(sketchfab).prop("width", "<?= $width ?>%")
|
$(sketchfab).prop("width", "<?= $width ?>%")
|
||||||
var height = get_height(sketchfab, <?= $ratio ?>)
|
var height = get_height(sketchfab, <?= $ratio ?>)
|
||||||
$(sketchfab).prop("height", height)
|
$(sketchfab).prop("height", height)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
adjust_height();
|
||||||
|
});
|
||||||
|
$( window ).resize(function() {
|
||||||
|
adjust_height();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue