您好,登錄后才能下訂單哦!
微信小程序swiper實現滑動放大縮小效果?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
具體代碼如下所示:
<swiper class="swiper-block" previous-margin="90rpx" next-margin="90rpx" current="0" bindchange="swiperChange"> <block wx:for="{{imgUrls}}" wx:index="{{index}}"> <swiper-item class="swiper-item"> <image mode="aspectFill" src="{{item}}" class="slide-image {{swiperIndex == index ? 'active' : ''}}"/> </swiper-item> </block> </swiper> .swiper-block{ height: 480rpx; width: 100%; } .swiper-item{ display: flex; flex-direction: column; justify-content: center; align-items: flex-start; overflow:unset; } .slide-image{ height:320rpx; width: 520rpx; border-radius: 9rpx; box-shadow: 0px 0px 30rpx rgba(0, 0,0,.2); margin: 0rpx 30rpx; z-index: 1; } .active{ transform: scale(1.14); transition:all .2s ease-in 0s; z-index: 20; }.swiper-block{ height: 480rpx; width: 100%; } .swiper-item{ display: flex; flex-direction: column; justify-content: center; align-items: flex-start; overflow:unset; } .slide-image{ height:320rpx; width: 520rpx; border-radius: 9rpx; box-shadow: 0px 0px 30rpx rgba(0, 0,0,.2); margin: 0rpx 30rpx; z-index: 1; } .active{ transform: scale(1.14); transition:all .2s ease-in 0s; z-index: 20; } Page({ data: { imgUrls: [ 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' ], indicatorDots: false, autoplay: false, interval: 5000, duration: 1000 }, swiperChange(e) { const that = this; that.setData({ swiperIndex: e.detail.current, }) } })
關于微信小程序swiper實現滑動放大縮小效果問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。