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

remove wrapper height once loaded #115

Open
freder opened this issue Dec 4, 2017 · 1 comment
Open

remove wrapper height once loaded #115

freder opened this issue Dec 4, 2017 · 1 comment

Comments

@freder
Copy link

freder commented Dec 4, 2017

I'm using the height prop with a roughly estimated value to prevent all items from loading immediately (since their initial height is 0, as long as the images have not been loaded). once an item has loaded, I'd like to remove the height / set it to auto.

it would be nice if the lib provided an option for this. — in the meantime, what would be the easiest way to achieve this?

@tzimmermann
Copy link

tzimmermann commented Jan 2, 2018

I agree, it would make sense to unset the height prop once the component is visible (and just let the rendered component take up as much space as it needs).
In the meantime, it also works to just set/unset the height via CSS as a workaround. LazyLoad already assigns the required classnames for this (I use JSS syntax):

        '.LazyLoad': {
            height: 100, // or whatever your estimated height might be
        },
        '.LazyLoad.is-visible': {
            height: 'auto',
        },

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

No branches or pull requests

3 participants