Skip to content
Snippets Groups Projects
Commit 79c8c88f authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5647: adding responsive image component

parent b1b8798a
No related branches found
No related tags found
1 merge request!14Feature/istwcms 5647 ebremner migrate node
picture {
img {
width: 100%;
}
width: 100%;
}
src/patterns/04-components/responsive-image/images/president_large.jpg

41.2 KiB

src/patterns/04-components/responsive-image/images/president_medium.jpg

33.6 KiB

src/patterns/04-components/responsive-image/images/president_small.jpg

14.2 KiB

src/patterns/04-components/responsive-image/images/president_xlarge.jpg

55.9 KiB

src/patterns/04-components/responsive-image/images/president_xsmall.jpg

12.5 KiB

{% if output_image_tag %}
{{ img_element }}
{% else %}
<picture class="uw-picture">
{% if sources %}
{#
Internet Explorer 9 doesn't recognise source elements that are wrapped in
picture tags. See http://scottjehl.github.io/picturefill/#ie9
#}
<!--[if IE 9]><video style="display: none;"><![endif]-->
{% for source in sources %}
<source srcset="{{ source.srcset|raw }}" media="{{ source.media }}" type="{{ source.type }}" />
{% endfor %}
<!--[if IE 9]></video><![endif]-->
{% endif %}
{# The controlling image, with the fallback image in srcset. #}
<img class="uw-picture__fallback" src="{{ img_element }}" alt="{{ alt }}">
</picture>
{% endif %}
sources:
- srcset: '/images/president_xlarge.jpg'
media: 'all and (min-width: 63.19rem)'
type: 'image/jpeg'
- srcset: '/images/president_large.jpg'
media: 'all and (min-width: 49.81rem)'
type: 'image/jpeg'
- srcset: '/images/president_medium.jpg'
media: 'all and (min-width: 30rem)'
type: 'image/jpeg'
- srcset: '/images/president_small.jpg'
media: 'all and (min-width: 25rem)'
type: 'image/jpeg'
- srcset: '/images/president_xsmall.jpg'
media: 'all and (min-width: 15rem)'
type: 'image/jpeg'
img_element: '/images/president_xlarge.jpg'
alt: 'Alternative text'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment