Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Media Query images using <source> tag not working #103

Closed
csantos1113 opened this issue Jan 30, 2018 · 2 comments
Closed

Media Query images using <source> tag not working #103

csantos1113 opened this issue Jan 30, 2018 · 2 comments

Comments

@csantos1113
Copy link

As you know, there is a technique to render one image or another one with media queries from html.

<picture>
    <source media="(min-width: 768px)" srcset="image-large.png"/>
    <img class="imgs" src="small.png"/>
</picture>

but the result of using this polyfill window.objectFitImages( 'img.imgs', { watchMQ: true } ) is always giving me this inline style:

background-image: url("small.png");
background-position-x: center;
background-position-y: center;
background-repeat: no-repeat;
background-origin: content-box;
background-size: cover;

How can I change the source dynamically?

@csantos1113
Copy link
Author

related to #85

@fregante
Copy link
Owner

picture is not supported. Duplicate of #3

Repository owner locked and limited conversation to collaborators Jan 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants