0

Hi I am using https://github.com/saravmajestic/ionic/tree/master/tabbedSlideBox

It works great for scrollable tabs, but I find that as I use more than a few scrollable tabs (more than 4-5 tabs) the performance drops considerably. This is because it's trying to create the view content for all the tab-slide-boxes at the start.

I have tried to use it with 30 scrollable tabs and it takes about 3-4 seconds to show the first tab.

What would be the way to delay the creation of the view content until the slide-change event for all the other tabs except for the tab in focus? That way the focused tab can load quicker and other tab views can be shown with a spinner when the user taps on the tab.

andthereitgoes
  • 819
  • 2
  • 10
  • 24

1 Answers1

0

I had a similar issue with the ion-slide-box. When i had more then 5-6 slides, The performance decreased drastically. I took more then 10 seconds to load a slide.

My solution for that was to construct only 3 slides at any time - the current slide, the next one and the previous one.

I used this trick: Wrap the content of your slide in a DIV and add the ng-if like this

<ion-slide-box class="blackBg" on-slide-changed="slideChanged(index)" show-pager="false" active-slide="photoIndex">

        <ion-slide ng-repeat="photo in photos track by $index">

            <div ng-if="$index >= (photoIndex-1) && $index <= (photoIndex+1)">

                 // You slide content here...

            </div>

       </ion-slide>

</ion-slide-box>
Vandervidi
  • 642
  • 2
  • 14
  • 32
  • 1
    Thanks for adding your solution. Much appreciated. I have been trying myself and one thing I tried was decreasing the data available to render and only pulling data on-slide-changed. Your trick looks interesting as well. Let me try your solution (mainly because there's a good chance that the user might tap on a slide which might beyond next and previous) and I will get back to you. First look, I think I might end up with mixing your trick with whatever I have got so far. Will get back to you. – andthereitgoes Dec 07 '15 at 13:57
  • Just making a note for future reference. Not the exact solution that I was looking for but it was a good inspiration. Thus, I will accept it. – andthereitgoes Jan 05 '16 at 16:46