I’m wanting to remove and add slides from a slidebox dynamically in order to prevent two many elements being created on the dom.
At the moment I have a list of a bunch of items. I want to represent this list as: prev-prev-item, prev-item, middle-item, next-item, next-next-item. I would start at middle item, on going next slide I want to remove prev-prev and add on a next-next-next, on going prev slide i want to remove next-next and add prev-prev-prev. However doing so seems to cause strange issues with disappearing slide content.
I edited your pen and it’s almost working, except that the function I’m using to remove the first item of the array is removing 2 itens and I can’t get to know why!
PS: oh, also I did it with 3 slides, it was easier for me to think the logic.
Hi @carina, I also needed to add slides dynamically on the left side and I used a similar approach :-]
My only problem now is the height of the slides are not being updated (always the height of the biggest slide). There seems to be a solution here, but I haven’t tested it yet. In case you’re having a similar problem, the post is this one.
I’m not sure if this is a question but you are right, limits will in most cases be necessary. In my case, I will have at least a limit on the left side (on the start of the list).
I will extend my example and post an update here in case it’s useful for you but it will take me a couple of days since I’m pretty swamped with work at the moment.
Yes that will be useful. I have worked out a solution where at start of list, active slide index will be 0 with [0,1] slides. At the end of list, active slide index will be 1 with [N-2,N-1] slides. In between active slide index will be 1 with three slides.
I see little flicker when going forward/backward on desktop chrome. BUT on android (galaxy s3, kit kart) this worsens. When I move to next slide, it moves to next slide, then move to previous one finally settling on next slide again. Similar case with going backwards.
@outerbound I am trying to do the same thing in my app and found this post. I have the same flickering and issues with the slide function that you are mentioning. Did you ever find a solution for this?? Any help appreciated.