Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for <picture> element #17

Open
brianjacobs-natgeo opened this issue Oct 12, 2020 · 1 comment
Open

Support for <picture> element #17

brianjacobs-natgeo opened this issue Oct 12, 2020 · 1 comment

Comments

@brianjacobs-natgeo
Copy link

Hi, great library!

In using this I've wanted to use it for images within the <picture> element

Because image-focus looks for the parentElement of an image as the container, styling can get messed up if the parent is a <picture>. This line has worked as a fix for me, bypassing the parent <picture>

this.container = imageNode.parentElement.tagName == "PICTURE" ? imageNode.parentElement.parentElement : imageNode.parentElement;

Alternatively, allow me to explicitly set a container option that would override the default parentElement

frsinn added a commit to frsinn/image-focus that referenced this issue Sep 12, 2023
This is a more customizable than the one suggested in third774#17. It should also be a
non-breaking change as `container` is optional. If a user did not pass
`container` as option, we fall back to the current behaviour.
frsinn added a commit to frsinn/image-focus that referenced this issue Sep 12, 2023
This is a more customizable than the one suggested in third774#17. It should also be a
non-breaking change as `container` is optional. If a user did not pass
`container` as option, we fall back to the current behaviour.
@frsinn
Copy link

frsinn commented Sep 12, 2023

Hi @brianjacobs-natgeo, I proposed a change to the library that follows your proposed solution using options, see #50.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants