defines image width with percentages
This commit is contained in:
parent
7c1ee9d4d7
commit
d86e63b9f5
|
@ -9,6 +9,13 @@ class Module extends AbstractModule
|
|||
{
|
||||
const NAMESPACE = __NAMESPACE__;
|
||||
|
||||
const IMAGE_WIDTH = [
|
||||
'25' => '25 %',
|
||||
'50' => '50 %',
|
||||
'75' => '75 %',
|
||||
'100' => '100 %',
|
||||
];
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
return include __DIR__ . '/config/module.config.php';
|
||||
|
|
|
@ -21,13 +21,11 @@ class ImageViewerBlockForm extends Form
|
|||
|
||||
$this->add([
|
||||
'name' => 'o:block[__blockIndex__][o:data][width]',
|
||||
'type' => Element\Number::class,
|
||||
'type' => Element\Select::class,
|
||||
'options' => [
|
||||
'label' => 'Width in pixels',
|
||||
],
|
||||
'attributes' => [
|
||||
'min' => '100',
|
||||
],
|
||||
'label' => 'Width',
|
||||
'value_options' => Module::IMAGE_WIDTH,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->add([
|
||||
|
|
|
@ -74,11 +74,10 @@ class ImageViewer extends AbstractBlockLayout
|
|||
static $id = 0;
|
||||
|
||||
$media = $attachments[0]->item()->media()[0];
|
||||
$width = $block->dataValue('width');
|
||||
return $view->partial('common/block-layout/imageViewer', [
|
||||
'zoom' => $block->dataValue('zoom'),
|
||||
'title' => $block->dataValue('title'),
|
||||
'width' => $width,
|
||||
'width' => $block->dataValue('width'),
|
||||
'image' => $media->primaryMedia()->thumbnailUrl('large'),
|
||||
'id' => 'iv-' . ++$id,
|
||||
]);
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
?>
|
||||
|
||||
<style>
|
||||
.archive-img {
|
||||
width: <?= $width ?>px;
|
||||
<!-- width: 50%; -->
|
||||
#<?= $id ?> {
|
||||
width: <?= $width ?>%;
|
||||
}
|
||||
<?php if ($zoom == true) { ?>
|
||||
#<?= $id ?> {
|
||||
|
@ -51,13 +50,12 @@
|
|||
|
||||
<?php if ($zoom == true) { ?>
|
||||
<script>
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
wheelzoom(document.querySelector('#<?= $id ?>'));
|
||||
});
|
||||
*/
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
wheelzoom(document.querySelector('#<?= $id ?>'));
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue