Swiper 是一個開源免費的移動觸摸插件。javascript
在使用中遇到這樣一個問題,記錄一下。java
page 間切換效果 使用 fade 的時候,若是每一個頁面的大小不同, 好比第一個頁面全屏, 第二個頁面比第一個小, 那麼切換到第二頁的時候, 第一頁的內容還能夠看到。ide
還有,使用 fade
過分方法,onSlideChangeEnd
回調偶爾觸發,偶爾不觸發。 所以使用 onTransitionEnd;
插件
解決方案:code
var mySwiper = new Swiper('.swiper-container',{ pagination: '.swiper-pagination', nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', effect: 'fade',// tips fade: { crossFade: true, }, onTransitionEnd: function (swiper) { console.info("頁面跳轉到第:", swiper.activeIndex, " 頁") } })