I have some question regarding apostrophes apostrophe-images-widgets
and its srcset
functionality. It's explained in you Documentation under Responsive Images. I've implemented this solution but i think I misunderstood something becuase the delivered image is still one-half
size as background of the parent div focal-point-test
.
I mean this:
So the actual img with srcset
attribute:
{# lib/modules/my-image-widget/views/widget.html #}
<img src="{{ apos.attachments.url(data.widget._image.attachment, { size: data.options.size or 'full' }) }}" srcset="{{ apos.images.srcset(data.widget._image.attachment) }}" sizes="{{ data.options.sizesAttr or '100vw' }}" alt="{{ data.widget._image.description or data.widget._image.title }}">
Is in the the image but there is also a background defined for the parent focal-point-test
with:
{% set image = apos.images.first(data.page.main) %}
{% if image %}
<div class="focal-point-test" style="
{%- if apos.attachments.hasFocalPoint(image) -%}
background-position: {{ apos.attachments.focalPointToBackgroundPosition(image) }};
{%- endif -%}
background-image: url({{ apos.attachments.url(image, { size: 'one-half' }) }})"></div>
{% endif %}
In this case two images will overlap one correct defined image with focalPoint
cropping and the actual img
element which has the srcset
attribute but no background-size: cover;
I found out that you are hiding the img in your image widget:
apos-slideshow .apos-slideshow-item img {
visibility: hidden;
width: 100%;
height: auto;
}
So then the actual img with srcset
would be hidden and the parent div in this case .apos-slideshow-item
will deliver the image still in full size.
So I wanted to ask for some clarification what I have misunderstood in this case?