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