-
Notifications
You must be signed in to change notification settings - Fork 237
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 un-initialized content with dynamic data #81
Comments
For what it is worth, I am using angular-slick and do not have any issue. Here is part of my code:
|
I'm not sure if this will help you but I had a similar issue and fixed it somewhat this way. The elements still flash briefly and it causes elements still move around, but I don't end up with a giant list not in a carousel. If you want it 100%, then make sure to call your beforeSlick() before you initialize/update the carousel data. My situation is a little unique too because my carousel data is dynamic (updates via socket.io) and the DOM wasn't updating, I found the ng-if worked to trigger angular to redraw the DOM. Anyway, you can give this a shot. In the angular slick JS file:
Here's some Jade showing how I'm doing it:
In the controller.js that the carousel sits in:
|
@Kenishi I think your example code should be: scope: {
data: '=',
initialSlide: '@',
beforeSlick: '=',
afterSlick: '='
// ... options ...
}, Thanks for sharing. |
@jon64digital Not sure if you used one of the solutions above, what I did was to make the wrapping element width span the 9 items Im initially loading, in the largest state available and floated them to the left before the slick dom elements are generated and slick-initialized is added as a class.
This mimics the position. of when slick is initialized. We also found that lazy loading is absolutely needed for our case, so we limited our initial load to 9 items per slider and have 3 displaying. Would say that you can pair it with @Kenishi 's solution as well. So we all know that this repo is not very well maintained, you should checkout this issue slick/issues/1005 - regarding kenwheeler/slick#1005 so that the on-load executes in the correct manner. Also see #100 on Slick.js dist we ended up with:
|
@jon64digital hey, have you solved this problem, I got the same issue. |
@Kenishi Thank you so much! This method really works for me. |
I'm using init-onload="items" because my slides are inside an ng-repeater.
The trouble is that since I changed the slides from static to Angular/repeater I find that all of the slides flash in a column before being initialized into a row. This doesn't seem to happen when they are hard coded as static slides in the HTML. Does anybody know how this can be fixed?
The text was updated successfully, but these errors were encountered: