How tow to show second tab active in framework 7 swiper-slide

810 Views Asked by At

I am using framework7 to build the mobile app, and swiper-slide layout structure. I wanted to second tab to active in 3 tabs structure. But when I use below code another swiper animations are getting affecting. I used below swiper code to make second tab active. Please, can someone help to fix this issue.

 var mySwiper = new Swiper('.swiper-container', {
         initialSlide: 2,
         speed: 600,
         spaceBetween: 100
     });

3

There are 3 best solutions below

0
On

Finally i found solution, just added tab id myApp.showTab('#tab2');

0
On

I think you can add the class swiper-slide-active to the slide to make it appear first, i'm sorry i'm not sure, but why not jumping to the desired slide on page load?

mySwiper.slideTo(index, speed, runCallbacks);

Run transition to the slide with index number equal to 'index' parameter for the duration equal to 'speed' parameter.

index - number - index number of slide
speed - number - transition duration (in ms). Optional
runCallbacks - boolean - Set it to false (by default it is true) and transition will not produce onSlideChange callback functions. Optional

More here in the methods section: http://idangero.us/swiper/api/#parameters

0
On
myApp.showTab("your tab id ");