forces iframe width with jquery
This commit is contained in:
parent
92da216cff
commit
fd225e386b
|
@ -9,6 +9,12 @@ class Module extends AbstractModule
|
|||
{
|
||||
const NAMESPACE = __NAMESPACE__;
|
||||
|
||||
const RATIOS = [
|
||||
'1.777' => '16:9',
|
||||
'1.333' => '4:3',
|
||||
'2' => '2:1',
|
||||
];
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
return include __DIR__ . '/config/module.config.php';
|
||||
|
|
|
@ -31,6 +31,7 @@ return [
|
|||
'SketchfabBlockForm' => [
|
||||
'title' => '',
|
||||
'width' => 600,
|
||||
'ratio' => '2',
|
||||
'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;',
|
||||
]
|
||||
]
|
||||
|
|
|
@ -75,8 +75,12 @@ class Sketchfab extends AbstractBlockLayout
|
|||
static $id = 0;
|
||||
|
||||
$media = $attachments[0]->item()->media()[0];
|
||||
$width = 900;
|
||||
$height = $width / $block->dataValue('ratio');
|
||||
return $view->partial('common/block-layout/sketchfab', [
|
||||
'title' => false,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'sketchfab_iframe' => $media->mediaData()['html'],
|
||||
]);
|
||||
//return $media->mediaData()['html'];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="archive_org-wrap" style="position:relative;">
|
||||
<div class="sketchfab-wrap" style="position:relative;">
|
||||
|
||||
<?php
|
||||
if ($title !== false && $title !== "") {
|
||||
|
@ -11,3 +11,12 @@
|
|||
<?= $sketchfab_iframe ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var sketchfab = $(".sketchfab-wrap").find('iframe');
|
||||
$(sketchfab).prop('width', <?= $width ?>);
|
||||
$(sketchfab).prop('height', <?= $height ?>);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue