-
Notifications
You must be signed in to change notification settings - Fork 112
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
Component with effect has a wrapping span with custom styles predefined #33
Comments
This would be a good solution, the only issue I see is that the wrapper element is also used when Thanks for filling this issue @elamperti, will mark it as |
@Aljullu I am also running into a similar issue caused by the pre-defined styles in the LazyLoadImage.jsx file on line 77. Is there any way that you could remove the "display:inline-block" style in that span? Or could you give more context on why you added this style? |
@asimoesmcartor the I'm considering to add a In the short term, you can set: .lazy-load-image-background {
display: block !important;
} in your CSS and that would overwrite the default |
@Aljullu Ahh perfect. Thank you so much! I will use the workaround for now. I think I was just missing the "!important" part and it was blocking me. Still learning over here! I'll keep an eye on this issue just in case you decide to pass the placeholder and wrapper props. Thanks again! |
@Aljullu May I raise a PR with |
@Aljullu 👋 Hey there! Would it be OK if I worked on the |
Sure thing @johnstonbl01! I'm happy to review any new PRs that are pushed to the repo. Make sure to take a look at #46 in case you think that might be good enough for your use-case. Otherwise maybe it's a good base to start from. It has got big conflicts but I think it's just formatting (spaces → tabs). |
Will do - thanks! |
A beta version with the new
Thanks @johnstonbl01 for the contribution. |
@Aljullu Thanks for adding this, can you please add an example to the docs for how to use the wrapperProps object as I haven't been able to get it working with different tries. Thanks |
It still has an inline-block display but, it is not in a CSS class, is inline style. Can anyone show me how could I remove it? https://github.com/Aljullu/react-lazy-load-image-component/blob/master/src/components/LazyLoadImage.jsx - line 115 |
Bug description
would be), but instead it becomes an
When a has an
effect
property defined (e.g."opacity"
), the image is wrapped with a span (where all the corresponding classes are applied (e.g.lazy-load-image-loaded
)). Said span comes with some styles already defined in the component, as seen in methodgetWrappedLazyLoadImage()
of LazyLoadImage.jsx. This raises problems when the wrapping element is expected to have its default behavior. In my case, I needed it to stay displayed as ablock
(as aninline-block
. In my case it breaks my view (see screenshot below)To Reproduce
Create a with an effect and inspect it.
Expected behavior
The wrapping element shouldn't change how the component is rendered.
Perhaps the style for the wrapper should be defined in the CSS of each effect instead.
Screenshots

Technical details:
Maybe it is related -or can be circumvented- if #31 is implemented
The text was updated successfully, but these errors were encountered: