Closed humbertqz closed 5 years ago
The div
is made for the placeholder animation, because you have the actual image and placeholder wrapped inside.
There are two solutions:
width
and height
and apply applyAspectRatio
placeholder
= false
, which will remove placeholder and the wrapping div
, plus you will lost the animation from the placeholder.let me know.
Maybe that could be a feature?
Remove everything but the img tag.
sure i can looking into that over the weekend :) but you lost beautiful animation 👍
Nice, thanks. 😄
Could you please help on testing? react-simple-img@1.14.0-beta.1
you have to set placeholder={false}
Yes!, but i never used a beta repo, how can i download it? I was using the component in a GatsbyJs project.
just yarn add react-simple-img@1.14.0-beta.1
or npm i react-simple-img@1.14.0-beta.1
. i did testing with my own demo and it works, just want to double check with yours before publishing.
Yes, it works this is my component:
<SimpleImg height={440} src={this.props.imgsrc} placeholder={false} />
This is what is rendered:
<img src="/static/thumb-plaza-cataluna-6106ec93376385a64fbf1cd99450ec09.jpg" srcset="" data-placeholder="false" data-src="/static/thumb-plaza-cataluna-6106ec93376385a64fbf1cd99450ec09.jpg" height="440" style="transition: all 0.3s ease 0s; opacity: 0; visibility: visible;">
Set the opacity: 0; by default, is there a way to change this?
thanks for the testing! i forgot to set opacity back to 1 for the animation :(
try this version react-simple-img@1.14.0-beta.3
should only render and animate when finished loading
It's working this is the rendered element:
<img src="/static/thumb-plaza-cataluna-6106ec93376385a64fbf1cd99450ec09.jpg" srcset="" data-placeholder="false" data-src="/static/thumb-plaza-cataluna-6106ec93376385a64fbf1cd99450ec09.jpg" data-end-style="opacity:0;" style="transition: all 0.3s ease 0s; opacity: 1; visibility: visible;">
thanks @humbertqz will publish today! thank you for your testing ❤️
v1.14.0 released, i will close the issue. feel free to re-open if you find other issues 👍
Is there a way to use the component without the wrapping div with flexbox styling and fixed height?
I'm using in the img tag width: 100%; height: auto; to make my image responsive.