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
Flash of Unstyled Content for the Orbit plugin #1707
Comments
I'm experiencing the same issue using Foundation 4.0.4:- An unstyled list of components in the slider visibly load and then collapse into the styled version when loading is complete. This seems to have been an issue in older versions of Orbit as well. The stand-alone version (before Foundation) suggests a fix (see the "Achieving Perfection" tab): The fix is almost exactly what I'd like to use but it does not seem to work with Orbit in Foundation 4.0.4. When I tried, it hid the slider entirely. Also, the fixed width and height won't work now that Orbit is responsive. Is there a fix someone is currently using? It may be useful to have a section in the Orbit docs for this. |
@smaboshe Yeah, and the version of the orbit slider you linked to is deprecated. It makes no sense why that feature is not in the new slider or it's just that I can't find the right documentation for it. |
After poking around the Interwebs: The official fix for this in Foundation 3 is to use the "Graceful Orbit Loading State" documentation:
The reason it works in Foundation 3 is because a class called "orbit" is added when Orbit is completely loaded. Orbit has changed quite a bit from Foundation 3 to Foundation 4. I do not see a similar "orbit" class being added. @smileyj68 or @mhayes is there a recommended "Graceful Orbit Loading State" approach for Foundation 4? |
After doing some tinkering and referring to the Foundation 4 Orbit documentation (http://foundation.zurb.com/docs/components/orbit.html) the following CSS seems to give me what I need. My #featured {
/* Pre-loading animation */
background: url(loading.gif) center center no-repeat;
}
#featured ul {
/* Prevent bullets showing before .orbit-container is loaded */
list-style-type: none;
}
#featured img {
/* Hide images before .orbit-container is loaded */
display: none;
}
#featured .orbit-container img {
/* Show images when .orbit-container is loaded */
display: block;
} This is a quick-and-dirty fix. If you have something more elegant, I'm happy to use that instead. |
This manages to fix the problem and while maintaining the dimensions of the div. Add the class 'orbit-slides-container' to the Then add this to the stylesheet:
and the following line to foundation.orbit.js in the callback for
The line-before-last seems to provide the best effect. |
Building on the solution @smaboshe provided, I came up with the following. SCSS:
And the CSS if you're not using SCSS:
|
Thanks for the idea of including the slideshow-wrapper, worked great! We included a CSS3 loading animation inside an optional |
There are some issues with the code in 31f97a9 (wrong vendor prefixes on the transforms in the animations and the display logic for list items is too broad (bullets are being suppressed when they shouldn't)). I found all I had to add to avoid the FOUC was the following: ul[data-orbit] {
margin: 0;
padding-left: 0;
list-style-type: none;
}
/* initially, hide all slides... */
ul[data-orbit] li,
ul[data-orbit] .orbit-caption {
display: none;
}
/* ...except for the first one */
ul[data-orbit] li:first-child { display: block; }
/* show slides once .orbit-container is loaded */
.orbit-container ul[data-orbit] li,
.orbit-container ul[data-orbit] .orbit-caption {
display: block;
} |
Thanks adion, that worked a treat. |
Thanks adion, that worked perfectly. |
adion, that's awesome. Thanks! |
Great fix Adion - works beautifully! |
it doesn't work for me using flex grid, any idea? |
This is what I'm doing (using flex grid) |
http://foundation.zurb.com/docs/components/orbit.html
You can view the issue there and just keep refreshing the page and you should see it.
The text was updated successfully, but these errors were encountered: