How to render first slide and render other slides in $timeout?


#1

I have some slides, maybe 20 or more than, in ion-slide-box, and each slide has ion-view tag, and some slides has an image, which can zoom. I meet some difficulty that when I click an button to show the ion-slide-box on ion-view, it needs waiting some time. Some I want to render the first slide and render others in $timeout. But I don’t know how to do it. Is there anyone who knows how to achieve it? Thanks a lot.


#2

Load only one slide and the neighbours of that slide . You can achieve this by adding a CSS class with display:none . You know your current slide position and +1/-1 are the neighbours … everything else has the class with display:none . When you incremet the slide you could have a trigger that will remove that CSS class and add it to the slide which is not a neighbour anymore


#3

Thank you, I will try it.


#4

@ovidiumihota I think I found a better way to solve the problem. http://codepen.io/mhartington/pen/kFhAp?editors=1000


#5

Looks good. I’m glad you figured out :slight_smile: !