image-focus
image-focus copied to clipboard
Support for <picture> element
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
Hi @brianjacobs-natgeo, I proposed a change to the library that follows your proposed solution using options, see #50.