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
Graceful loading of slides? #1741
Comments
@kavonatsalv You can try considering the |
+1
|
This is really easy to do. Put a class on your slider, in your css set it to display none, and then add .slick-initialized: display block, and it shows up when slick is loaded. You may want to wrap your .slick() call in a window.load too if you're still seeing problems. |
Thanks for quick reply @kenwheeler! I fixed this by using
|
Another option is to hide all the slides except the first one ( |
You can avoid flash of unstyled content completely in CSS. Perhaps worth adding to the "get started" section of the site.
|
@masi 's solution is perfect. Slick add a class .slider { display: none; }
.slider.slick-initialized { display: block; } |
It might be worth changing your css to use visibility instead of display to avoid issues with sizing child elements.
|
I was having issues taming FOUC on the Slider Syncing usage with slider-nav and slider-for, in particular for the slider-nav Initially displaying the slider container to
|
Using the ideas above, I found a pleasing (not perfect) solution for the problem, i guess:
|
@ahmadalfy I found your fix to be the perfect solution to the slick vertical loading issue. |
@RedlingshoeferUndHofmann 's answer is what I ended up using, worked great |
@RedlingshoeferUndHofmann 's answer is a nice solution for this, pretty handy. Cheers! |
Great workarounds, thanks! To shorten the code a bit you can use the .your-class:not(:first-child) {
visibility: hidden;
}
.slick-initialized.your-class {
visibility: visible;
} |
@RedlingshoeferUndHofmann thanks, that is exactly what I needed. This also works with my custom settings to display the dots below the slider, where I do |
using @RedlingshoeferUndHofmann - great answer! |
Thanks all and @RedlingshoeferUndHofmann, works like a charm. Only thing I did was replacing |
Nothing I try seems to help with this. All these solutions leave me with a temporary empty white expanding space while the slider waits for the javascript to finish loading. Is there any way to display the first slide while waiting for the javascript to load? You can see the issue here. |
@lesliekirk - Have you tried to use You can also throw |
@BenSpace48 that worked for me, Display none on all of them was causing some of the slides not to load properly with lazyloading. |
I managed to solve this problem with the help of some here in this comment, I hope it helps! I used the following JS and CSS requirements
And I made the following JS settings (in my case it was a banner, so 1 slide for everyone)
Now, in order not to "flash the sliders" and show more grandiose I put the following CSS.
So, during loading the first slide will be visible, and the others will be hidden, just when they become active they will be in Attention, Christiano. |
Thanks @ChristianoBourguignon I will give this a try later on! |
my version, if anyone needs it:
|
Based on @chris-griffin anwer .your-carrousel > .your-item { Note that I am using a direct child operator (">"), if any of you had put a limitation on the connection speed from the developer tools, you could see that before loading Slick the structure has a basic form ( that you printed yourself), but then Slick cuts the contents of its initial container, and encapsulates it in its own container classes. This makes it possible that with 2 custom classes, we handle the state before and after loading. |
Solution of @RedlingshoeferUndHofmann works a charm but I still have a little jump of the page content as the dots appear. I have tried display:block on ul.slick-dots and giving them a height to no avail. |
YOU NEED USE ANOTHER SLIDER AS SWIPER |
Hi Guys, let me cheer you up a bit, I think I found a solution to make this pretty. Perhaps you noticed Let's consider my initial html:
Set Resultant html:
This was you can play with CSS to show/hide placeholders (or loading gif) and slider.
|
Is there a way to hide Slick until its page has finished loading?
http://nowrongdoorsws.com.au/
Slick shows the slides beside each other while loading (a hard refresh should show this) and I would like to hide the area completely until everything has loaded for a more graceful result.
Is this possible?
Thanks. And sorry – I'm a bit rusty when it comes to JS.
:)
The text was updated successfully, but these errors were encountered: