微信小程序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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。