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

Proper approach for setting a Loading State for flicking slider #108

Open
monecchi opened this issue Jul 4, 2020 · 1 comment
Open

Proper approach for setting a Loading State for flicking slider #108

monecchi opened this issue Jul 4, 2020 · 1 comment

Comments

@monecchi
Copy link

monecchi commented Jul 4, 2020

I was hoping to create a HOC where I’d hook on Flickity events to set a loading state so that I could display a kind of mock or loading skeleton for the slider while flickity isn’t ready or when images have not loaded yet...

I’ve tried to use the lazyload event in order to check for images and then use useEffect(), useState() to define its loading state, but that seems too late for displaying a loading skeleton...

I also tried to apply a css class to the slides container when images were not yet loaded, but by using lazyload, the images are loaded so fast that the styles which mimic a loading skeleton are quickly removed after lazyload is done...

I’d really appreciate any hints regarding a proper way of achieving that effect...

@yaodingyd
Copy link
Owner

I'm afraid currently there is no good way to do this. We have this flickityReady internal state to indicate whether it's ready, but it's not exposed.

Maybe we could add a flickityReadyCallBack option

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

2 participants