File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ function initSwiper(swiperEl) {
2626 let isTabs ;
2727 let isRoutableTabs ;
2828 if ( $swiperEl . hasClass ( 'tabs' ) ) {
29- initialSlide = $swiperEl . children ( '. tab-active' ) . index ( ) ;
29+ initialSlide = $swiperEl . children ( 'swiper-slide' ) . indexOf ( $swiperEl . children ( '. tab-active') [ 0 ] ) ;
3030 isTabs = true ;
3131 isRoutableTabs = $swiperEl . find ( '.tabs-routable' ) . length > 0 ;
3232 }
Original file line number Diff line number Diff line change @@ -84,13 +84,14 @@ const Tab = {
8484 let swiper ;
8585 if ( $tabsEl [ 0 ] . nodeName . toLowerCase ( ) === 'swiper-container' && app . swiper ) {
8686 swiper = $tabsEl [ 0 ] . swiper ;
87- if ( swiper && swiper . activeIndex !== $newTabEl . index ( ) ) {
87+ const newTabIndex = swiper . slides . indexOf ( $newTabEl [ 0 ] ) ;
88+ if ( swiper && swiper . activeIndex !== newTabIndex ) {
8889 animated = true ;
8990 swiper
9091 . once ( 'slideChangeTransitionEnd' , ( ) => {
9192 tabsChanged ( ) ;
9293 } )
93- . slideTo ( $newTabEl . index ( ) , animate ? undefined : 0 ) ;
94+ . slideTo ( newTabIndex , animate ? undefined : 0 ) ;
9495 } else if ( swiper && swiper . animating ) {
9596 animated = true ;
9697 swiper . once ( 'slideChangeTransitionEnd' , ( ) => {
Original file line number Diff line number Diff line change 11<script >
2- import { onMount } from ' svelte' ;
2+ import { onMount , tick } from ' svelte' ;
33
44 import { restProps } from ' ../shared/rest-props.js' ;
55 import { colorClasses } from ' ../shared/mixins.js' ;
2929 Object .assign (wrapEl, swiperParams);
3030 wrapEl .initialize ();
3131 }
32+ tick ().then (() => {
33+ if (swipeable && wrapEl .swiper ) {
34+ wrapEl .swiper .update ();
35+ }
36+ });
3237 });
3338 </script >
3439
You can’t perform that action at this time.
0 commit comments