Background images?
Closed this issue · 2 comments
This is probably a feature request
Is there a way to do relative path background images while using an alias reference?
going by your docs, I know I can do it through the long form url //demo.cloudimg.io/width/500/none/_ALIAS_/boat.jpg
but I'm hoping to be able to use a relative path since I'd like to use ci-src
and css background-image
interchangeably.
Maybe if it was class bound? For example, if I add .ci-bgimage
to a div that includes a style
attribute with a background-image: url(some/image/reference.jpg)
property then the library knows to fetch and replace (and probably could get the best image because it would already know the width and height of the container).
For my use case the above would need to work with your alias functionality since I leverage it in the baseUrl
like below.
const ciResponsive = new window.CIResponsive({
token: 'demo',
baseUrl: '_images_/'
});
Hey @randallmlough,
It's on our roadmap, will be done in next release.
@randallmlough, hey
the feature is available in v2.2.0
doc: https://github.com/scaleflex/js-cloudimage-responsive#background-image
code sandbox: https://codesandbox.io/s/js-cloudimage-responsive-background-imxdm