40 lines
854 B
PHTML
40 lines
854 B
PHTML
<?php
|
|
$this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
|
|
'Sketchfab'));
|
|
?>
|
|
|
|
<div id="sketchfab_<?= $model_id ?>" class="sketchfab-wrap" style="position:relative;">
|
|
|
|
<?php if ($renderSourceLink) { ?>
|
|
<div class="source-link">
|
|
<a href="<?= $item_url ?>">Source</a>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<?= $sketchfab_iframe ?>
|
|
|
|
<?php if ($title) { ?>
|
|
<div class="item_title">
|
|
<?= $title ?>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
</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() {
|
|
adjust_height();
|
|
});
|
|
$( window ).resize(function() {
|
|
adjust_height();
|
|
});
|
|
</script>
|